Roger Binns wrote:
> Yang Zhang wrote:
>> Actually, this is only because Python 3 str is Python 2 unicode. Python
>> 2 (which I'm currently using, and which I believe most of the world is
>> using) str is a physical string of bytes, not a logical/decoded
>> character string. Python 2.6
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yang Zhang wrote:
> Actually, this is only because Python 3 str is Python 2 unicode. Python
> 2 (which I'm currently using, and which I believe most of the world is
> using) str is a physical string of bytes, not a logical/decoded
> character
Igor Tandetnik wrote:
> Yang Zhang wrote:
>> Pavel Ivanov wrote:
>>> BTW, ACID that you mentioned has nothing to do with snapshot
>>> isolation that you want to achieve. AFAIK only Oracle supports this
>>> kind of statement isolation level.
>> Actually, Oracle, Postgresql,
Yang Zhang wrote:
> Pavel Ivanov wrote:
>> BTW, ACID that you mentioned has nothing to do with snapshot
>> isolation that you want to achieve. AFAIK only Oracle supports this
>> kind of statement isolation level.
>
> Actually, Oracle, Postgresql, SQL Server, Firebird, and
Pavel Ivanov wrote:
> BTW, ACID that you mentioned has nothing to do with snapshot isolation
> that you want to achieve. AFAIK only Oracle supports this kind of
> statement isolation level.
Actually, Oracle, Postgresql, SQL Server, Firebird, and others support
snapshot isolation.
Roger Binns wrote:
> Yang Zhang wrote:
>> I copied and pasted this code straight from my actual application, which
>> uses blobs instead of integers, which I need to convert into strings
>> (since Python interfaces with blobs using the `buffer` type, not `str`).
>
> And for very good reason.
D. Richard Hipp wrote:
> On May 18, 2009, at 1:13 PM, John Elrick wrote:
>
>
>> John Elrick wrote:
>>
>>> SNIP
>>>
>>>
> I say this because your example implies that the Python wrapper
> starts
> the transaction automatically inside the execute, and I would not
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yang Zhang wrote:
> I copied and pasted this code straight from my actual application, which
> uses blobs instead of integers, which I need to convert into strings
> (since Python interfaces with blobs using the `buffer` type, not `str`).
And for
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
John Elrick wrote:
> Are you certain the wrapper is behaving that way?
The pysqlite wrapper (available as a sqlite3 Python module) by default
parses your SQL and starts and ends transactions behind your back, in
order to make it look like SQLite
On May 18, 2009, at 1:13 PM, John Elrick wrote:
> John Elrick wrote:
>> SNIP
>>
I say this because your example implies that the Python wrapper
starts
the transaction automatically inside the execute, and I would not
be
surprised if it did so BEFORE executing the SQL
John Elrick wrote:
> SNIP
>
>>> I say this because your example implies that the Python wrapper starts
>>> the transaction automatically inside the execute, and I would not be
>>> surprised if it did so BEFORE executing the SQL parameter.
>>>
>>>
>> The cursor() method that I call
SNIP
>> I say this because your example implies that the Python wrapper starts
>> the transaction automatically inside the execute, and I would not be
>> surprised if it did so BEFORE executing the SQL parameter.
>>
>
> The cursor() method that I call on the conn for the SELECT should give
SQLite doesn't support several simultaneous transactions on the same
connection to database. So in fact your select and insert statements
execute in the same transaction. And even more: your inserts are not
committed until your select is completely finished. So for your task
you should use
Yang Zhang wrote:
> John Elrick wrote:
>> Yang Zhang wrote:
>>> Roger Binns wrote:
>>>
Yang Zhang wrote:
> for i in (str(row[0]) for row in conn.cursor().execute('SELECT key
> FROM shelf ORDER BY ROWID')):
>
You are converting the key which is an integer
John Elrick wrote:
> Yang Zhang wrote:
>> Roger Binns wrote:
>>
>>> Yang Zhang wrote:
>>>
for i in (str(row[0]) for row in conn.cursor().execute('SELECT key FROM
shelf ORDER BY ROWID')):
>>> You are converting the key which is an integer into a string for no
>>>
Yang Zhang wrote:
> Roger Binns wrote:
>
>> Yang Zhang wrote:
>>
>>> for i in (str(row[0]) for row in conn.cursor().execute('SELECT key FROM
>>> shelf ORDER BY ROWID')):
>>>
>> You are converting the key which is an integer into a string for no
>> apparent reason.
>>
>
> I
Roger Binns wrote:
> Yang Zhang wrote:
>> for i in (str(row[0]) for row in conn.cursor().execute('SELECT key FROM
>> shelf ORDER BY ROWID')):
>
> You are converting the key which is an integer into a string for no
> apparent reason.
I copied and pasted this code straight from my actual
"Roger Binns" wrote in
message news:4a1127e1.1040...@rogerbinns.com
> If you also ask for the ROWID you will see that what is happening is a
> new rowid is generated for the replaced row so that if you are
> iterating over the table while modifying it then you effectively
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yang Zhang wrote:
> for i in (str(row[0]) for row in conn.cursor().execute('SELECT key FROM
> shelf ORDER BY ROWID')):
You are converting the key which is an integer into a string for no
apparent reason.
If you also ask for the ROWID you will see
Hi, for some reason the following program will loop forever:
#!/usr/bin/env python
import sqlite3
conn = sqlite3.connect(':memory:')
conn.text_factory = bytes
conn.execute('CREATE TABLE shelf (key INTEGER NOT NULL, value INTEGER
NOT NULL)')
for i in xrange(3):
conn.execute('INSERT INTO
20 matches
Mail list logo