Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58230
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'schema': 0.05; 'suppose': 0.07; 'exist,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'burak': 0.16; 'guessing': 0.16; 'message- id:@4ax.com': 0.16; 'pythonic': 0.16; 'query,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:flow': 0.16; 'then?': 0.16; 'library': 0.18; 'bit': 0.19; 'thu,': 0.19; 'seems': 0.21; 'new,': 0.24; 'url:home': 0.24; 'query': 0.26; 'shown': 0.26; 'header:X-Complaints-To:1': 0.27; "doesn't": 0.30; "i'm": 0.30; 'table': 0.34; "i'd": 0.34; 'could': 0.34; 'something': 0.35; 'case,': 0.35; 'version': 0.36; 'charset :us-ascii': 0.36; 'so,': 0.37; 'received:76': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'catch': 0.60; 'new': 0.61; 'simply': 0.61; 'kind': 0.63; 'such': 0.63; 'caused': 0.69; 'ugly,': 0.84; 'victor': 0.84; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Try-except for flow control in reading Sqlite |
| Date | Thu, 31 Oct 2013 22:45:05 -0400 |
| Organization | IISS Elusive Unicorn |
| References | <ac7cf18f-d4f4-41ef-966d-a35d2d0e39a8@googlegroups.com> <mailman.1728.1383003802.18130.python-list@python.org> <8f70ed52-a4ac-45f6-83b0-76a058074454@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-76-249-28-245.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 6.00/32.1186 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1903.1383273905.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383273905 news.xs4all.nl 15923 [2001:888:2000:d::a6]:53772 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58230 |
Show key headers only | View raw
On Thu, 31 Oct 2013 16:08:38 -0700 (PDT), Victor Hooi
<victorhooi@gmail.com> declaimed the following:
>Hi,
>
>You're right, if the databse doesn't exist, the sqlite3 library will simply create it.
>
>Hmm, in that case, what is the Pythonic way to handle this then?
>
>If the database is new, then it won't have the table I need, and it will return something like:
>
> sqlite3.OperationalError: no such table: my_table
>
>I suppose I can try the query, and catch OperationalError, and if so, create the new schema then?
>
>However, that seems a bit ugly, as I'm guessing OperationalError could be caused by a number of other reasons?
>
>Should I perhaps be using some kind of version table as Burak Aslan suggested?
>
>Cheers,
>victor
>
I'd use the capabilities of the database engine to query it for any
existing schema. As shown in my prior post...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Try-except for flow control in reading Sqlite Victor Hooi <victorhooi@gmail.com> - 2013-10-27 20:43 -0700
Re: Try-except for flow control in reading Sqlite Steven D'Aprano <steve@pearwood.info> - 2013-10-28 06:18 +0000
Re: Try-except for flow control in reading Sqlite Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-28 10:48 +0100
Re: Try-except for flow control in reading Sqlite Chris Angelico <rosuav@gmail.com> - 2013-10-28 17:36 +1100
Re: Try-except for flow control in reading Sqlite Victor Hooi <victorhooi@gmail.com> - 2013-10-27 23:57 -0700
Re: Try-except for flow control in reading Sqlite Chris Angelico <rosuav@gmail.com> - 2013-10-28 18:01 +1100
Re: Try-except for flow control in reading Sqlite Steven D'Aprano <steve@pearwood.info> - 2013-10-28 07:19 +0000
Re: Try-except for flow control in reading Sqlite Chris Angelico <rosuav@gmail.com> - 2013-10-28 18:02 +1100
Re: Try-except for flow control in reading Sqlite Burak Arslan <burak.arslan@arskom.com.tr> - 2013-10-28 10:17 +0200
Re: Try-except for flow control in reading Sqlite Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-28 19:43 -0400
Re: Try-except for flow control in reading Sqlite Victor Hooi <victorhooi@gmail.com> - 2013-10-31 16:08 -0700
Re: Try-except for flow control in reading Sqlite Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-31 22:45 -0400
csiph-web