On Nov 15, Joachim Selke <[EMAIL PROTECTED]> wrote:

> Maybe this problem is not related to the autocommit issue at all. What
> makes you conjecture that it is the cause here?

Initially the fact that in some of the first tests the table
was not populated, and later one of your tests in which everything
was ok, setting it to True.

> I would like to do some more systematic testing with a test case being
> as minimalistic as possible. Could you please prepare such a test case,

In the attachment there's a little example.
It doesn't use IMDbPY, but as far as I can tell the code is totally
equivalent.

It creates the columns, the 'kind_type' table; it connects to the
database and writes some data, first with SQLAlchemy and at the
end calling the cursor.  After that, it prints what's in the
db (reading it with the SQLAlchemy ORM).

Notice that it works with both MySQL and SQLite (and, after all,
IMDbPY works with every other database, and so...)


HTH,
-- 
Davide Alberani <[EMAIL PROTECTED]> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/
#!/usr/bin/env python

from sqlalchemy import *

# Your connection data.
CONNECT_URI = 'sqlite:////tmp/TEST_DB'
#CONNECT_URI = 'ibm_db_sa://USER:[EMAIL PROTECTED]:50000/DB'

metadata = MetaData()
idCol = Column('id', Integer(primary_key=True, nullable=False), primary_key=True)
kindCol = Column('kind', String(length=15), default=None)

ktTable = Table('kind_type', metadata, idCol, kindCol)
kindColIdx = Index('kind_idx', ktTable.c.kind)

engine = create_engine(CONNECT_URI, echo=True)
metadata.bind = engine
eng_conn = engine.connect()
cursor = eng_conn.connection.connection.cursor()
ktTable.drop(checkfirst=True)
ktTable.create(checkfirst=True)

kt_insert = ktTable.insert()

for value in 'movie', 'tv series', 'tv movie', 'video movie', 'tv mini series', 'video game', 'episode':
    kt_insert.execute(kind=value)

cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['using cursor'])


for result in ktTable.select(None).execute():
    print result

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to