Re: Python/SQLite best practices

2019-08-06 Thread Chris Angelico
On Wed, Aug 7, 2019 at 2:28 AM Dennis Lee Bieber wrote: > > On Mon, 5 Aug 2019 20:12:27 +0200, Karsten Hilbert > declaimed the following: > > > >Transactions involving several commands may require passing > >around of connections and/or cursors, however. > > > > Probably both -- as I reca

Re: Python/SQLite best practices

2019-08-06 Thread Jonathan Moules
* To be reliably INSERTed Byte data should be first converted to sqlite3.Binary(my_data) explicitly Interesting. Is that Python 2 specific, or also in Python 3. Because the latter would surprise me (not saying it isn't the case). Only tried on Python 3. I'm inserting raw byte versions of web

Re: Python/SQLite best practices

2019-08-05 Thread Cameron Simpson
On 06Aug2019 00:01, Jonathan Moules wrote: Some gotcha tips from using SQLite with Python that I've encountered. [...] * To be reliably INSERTed Byte data should be first converted to sqlite3.Binary(my_data) explicitly Interesting. Is that Python 2 specific, or also in Python 3. Because the

Re: Python/SQLite best practices

2019-08-05 Thread Jonathan Moules
Some gotcha tips from using SQLite with Python that I've encountered. You may already know some/all of these: * SQLite doesn't have a "Truncate" function - simply delete the file if possible for larger datasets. * Explicitly committing is good because the default python sqlite3 library does it

Re: Python/SQLite best practices

2019-08-05 Thread Chris Angelico
On Tue, Aug 6, 2019 at 7:45 AM David Raymond wrote: > The context manager transaction feature I can see using, and might actually > start switching to it as it's explicit enough. Though oddly, __enter__ > doesn't seem to actually begin a transaction, not even a deferred one. It's > only __exit_

RE: Python/SQLite best practices

2019-08-05 Thread David Raymond
"What's the advantage of this over letting the connection object do that for you? As the context manager exits, it will automatically either commit or roll back. If you want to guarantee closing _as well_, then you can do that, but you can at least use what already exists." After review I guess I

Re: Python/SQLite best practices

2019-08-05 Thread Chris Angelico
On Tue, Aug 6, 2019 at 5:05 AM David Raymond wrote: > I believe the default Connection context manager is set up for the context to > be a single transaction, with a commit on success or a rollback on a failure. > As far as I know it does NOT close the connection on exiting the context > manage

RE: Python/SQLite best practices

2019-08-05 Thread David Raymond
Not a full expert, but some notes: I believe the default Connection context manager is set up for the context to be a single transaction, with a commit on success or a rollback on a failure. As far as I know it does NOT close the connection on exiting the context manager. That only happens aut

Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
On Mon, Aug 05, 2019 at 08:12:27PM +0200, Karsten Hilbert wrote: > Transactions involving several commands may require passing > around of connections and/or cursors, however. Among chains of python code, that is. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mai

Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
On Mon, Aug 05, 2019 at 01:49:24PM -0400, Dave via Python-list wrote: > * Passing connections and cursors - good, bad indifferent? I try to avoid > passing file handles unless necessary, so I view connections and cursors the > same. Connections may be more long-lived, per thread perhaps. Cursor

Re: [python-sqlite] Re: pysqlite 2.8.0 released

2015-08-20 Thread Gerhard Häring
Yes, I forgot to "setup.py sdist upload". It's fixed now. Sorry for the trouble. I'm of course looking forward to hear if SQLAlchemy still works ok with this release. On Wed, Aug 19, 2015 at 10:10 PM, wrote: > Hi Gerhard - > > is the download missing? On Pypi I see 2.8.0 is registered but no >

Re: python sqlite THREADSAFE?

2007-09-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Sep 2007 10:37:51 +0200, EuGeNe Van den Bulke wrote: > Is the sqlite distributed with Python 2.5 compiled with the > -DTHREADSAFE=1 flag? My gutt feeling is Windows (yes) MacOS/Linux (no) > but ... Take a look at the `threadsafety` attribute of the module. Ciao, Marc 'BlackJ

Re: Python sqlite and regex.

2006-05-19 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > Paul McGuire wrote: > > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >> where '*' matches one or more characters, and '?' matches any > >> single > > > > oops, I meant '*' matches zero or more characters. > > '?'

Re: Python sqlite and regex.

2006-05-19 Thread Dan Sommers
On Fri, 19 May 2006 18:52:38 GMT, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > "Dan Sommers" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Doesn't SQL already have lightweight wildcards? >> >> SELECT somefield FROM sometable WHERE someotherfield LIKE '%foo%' > Yes it does - '%

Re: Python sqlite and regex.

2006-05-19 Thread Matt Good
Oops, sorry about the confusion regarding the built-in REGEXP. That's kind of disappointing. It would appear that the user-defined regexp function in the original post should work assuming the SQL and regex syntax errors are corrected. However, there *is* a GLOB built-in to SQLite 3 that has a d

Re: Python sqlite and regex.

2006-05-19 Thread Paul McGuire
"Dan Sommers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 19 May 2006 17:44:45 GMT, > "Paul McGuire" <[EMAIL PROTECTED]> wrote: > > > "Gerhard Häring" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > >> """ > >> The REGEXP operator is a special syntax f

Re: Python sqlite and regex.

2006-05-19 Thread Dan Sommers
On Fri, 19 May 2006 17:44:45 GMT, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > "Gerhard Häring" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> """ >> The REGEXP operator is a special syntax for the regexp() user >> function. No regexp() user function is defined by default and so

Re: Python sqlite and regex.

2006-05-19 Thread Paul McGuire
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: > > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >> where '*' matches one or more characters, and '?' matches any single > > > > oops, I meant '*' matches zero or

Re: Python sqlite and regex.

2006-05-19 Thread John Salerno
Paul McGuire wrote: > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> where '*' matches one or more characters, and '?' matches any single > > oops, I meant '*' matches zero or more characters. '?' also matches 0 characters -- http://mail.python.org/mailman/lis

Re: Python sqlite and regex.

2006-05-19 Thread Paul McGuire
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > where '*' matches one or more characters, and '?' matches any single oops, I meant '*' matches zero or more characters. In many applications, these tests are sufficient for most user queries. And this eliminates the pr

Re: Python sqlite and regex.

2006-05-19 Thread Paul McGuire
"Gerhard Häring" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Matt Good wrote: > > SQLite3 already has a REGEXP function, so you don't need to create your > > own. [...] > > Yes, but SQLite does not include a regular expression en

Re: Python sqlite and regex.

2006-05-19 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matt Good wrote: > SQLite3 already has a REGEXP function, so you don't need to create your > own. [...] Yes, but SQLite does not include a regular expression engine, and thus according to the SQLite docs you need to register a REGEXP function in order

Re: Python sqlite and regex.

2006-05-19 Thread Matt Good
SQLite3 already has a REGEXP function, so you don't need to create your own. As Dan mentioned you also have a problem in your expression: 'aa.[0-9]) You need a closing quote on the expression, and you need to match the close paren with an open paren, or remove it. Also, in case you weren't aware,

Re: Python sqlite and regex.

2006-05-19 Thread Dan Sommers
On Fri, 19 May 2006 14:47:10 +0200, Julien ARNOUX <[EMAIL PROTECTED]> wrote: > cur.execute("select foo from test where foo regex 'aa.[0-9])") > and the error is: > cur.execute('select foo from test where foo regex tata') > apsw.SQLError: SQLError: near "regex": syntax error I think you're missi

Re: Python & SQLite

2005-05-06 Thread Gerhard Häring
dcrespo wrote: >>There are specific python modules for SQLite on Linux. > > Which? I thought pysqlite works on Linux. Sure. What he probably meant was that there are binary installers for pysqlite from various Linux distributions (Debian, Gentoo, ...). > My important question is: If I develop a

Re: Python & SQLite

2005-05-06 Thread dcrespo
> There are specific python modules for SQLite on Linux. Which? I thought pysqlite works on Linux. My important question is: If I develop an app using Python-wxPython-PySQLite under Windows, and run it on Linux, it should work, ¿right? Daniel -- http://mail.python.org/mailman/listinfo/python-l

Re: Python & SQLite

2005-05-04 Thread Andy Jeffries
dcrespo wrote: > Does PySQLite run on Linux? Yes! >From my Gentoo laptop: andyvaio root # emerge -av pysqlite These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] dev-python/pysqlite-0.5.1 0 kB Total size of downloads: 0 kB Do you want me to

Re: Python & SQLite

2005-05-03 Thread Klaus Alexander Seistrup
dcrespo wrote: > Does PySQLite run on Linux? There are specific python modules for SQLite on Linux. -- Klaus Alexander Seistrup Magnetic Ink, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & SQLite

2005-05-03 Thread dcrespo
Does PySQLite run on Linux? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & SQLite

2005-05-03 Thread Pajo
Thnx, my first test app with sqlite is working... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & SQLite

2005-05-03 Thread Swaroop C H
On 5/3/05, Pajo <[EMAIL PROTECTED]> wrote: > What should I install so I can connect to sqlite from > Python. > One simple example would be very helpfull. You haven't mentioned which operating system you are using. For Windows, PySQLite binaries are available at http://initd.org/tracker/pysqlite F