Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 21, Joachim Selke [EMAIL PROTECTED] wrote: I tried it but there is no SQL command BEGIN TRANSACTION in DB2. The DB2 equivalent is called BEGIN COMPOUND -- but it seems it is used in a different way; just replacing this in your code is not enough. When you've time, you can try to find a way to make transactions work using the -e command line option; the --sqlite-transactions option does the equivalent of: -e 'BEFORE_EVERY_TODB:BEGIN TRANSACTION;' -e 'AFTER_EVERY_TODB:COMMIT;' -e 'BEFORE_INDEXES:BEGIN TRANSACTION;' -e 'END:COMMIT;' See README.sqldb, under ADVANCED FEATURES, for more information. Have you thought of using SQLAlchemy's Session feature? Can't be done easily within imdbpy2sql.py: it uses SQLObject/SQLAlchemy only to drop/create the tables and to get names of tables/columns; after that, for performance reasons, a cursor is extracted and its executemany method used. Hm, why is it truncated to VARCHAR(255)? Errr... I admit that now I'm Officially Embarrassed(tm). ;-) I wrote that code not even a month ago, and I was pretty sure that some server had limits on the length of VARCHAR. I've checked now, and you're right: no problem of any sort (despite the fact that I've written in the comments that up to 333 chars nobody complains... I'm wondering why I wrote it). I should control documentation about MySQL 4, but to be honest it would not be a big issue: MySQL 4 users can always use SQLObject or switch to MySQL 5. Before I wait another 8 hours: Do you know what VARCHAR size is needed to store all these names? I checked: the problems are in _character_ names: three names are more than 255 chars (max: 479), and other 3 are over 200. Longest movie title is 242, longest person name is 84 and the longest company name is 176 chars. Now I'm worried about the costs, in terms of wasted space and insert time, using a VARCHAR(512) instead of a TEXT or VARCHAR(255) column. I admit that I don't know very much about how databases works, at this level. Thanks, -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: Fixed. Now it's all to see if IMDbPY has decent performances on a DB2 server... :-) After running for about 8 hours, the script runs into an error: [...] SCANNING actor: Ferguson, Duane (I) SCANNING actor: Fernández, Florentino (I) * FLUSHING SQLData... SCANNING actor: Ferrer, Filipe * FLUSHING CharactersCache... SCANNING actor: Fiedler, John (I) * FLUSHING SQLData... SCANNING actor: Filipe, Laurent SCANNING actor: Fintesteanu, Ion * FLUSHING SQLData... SCANNING actor: Fitz, Florian David SCANNING actor: Fleenor, John P. * FLUSHING SQLData... SCANNING actor: Flores, Raul SCANNING actor: Fonda, Henry * FLUSHING SQLData... SCANNING actor: Ford, James (I) SCANNING actor: Forte, Joseph * FLUSHING SQLData... SCANNING actor: Fowler, John (II) SCANNING actor: Francesco, Deejay * FLUSHING SQLData... SCANNING actor: Franke, Holger (I) SCANNING actor: Frawley, William * FLUSHING SQLData... SCANNING actor: Fremont, Al * FLUSHING SQLData... SCANNING actor: Friedrich, Lothar SCANNING actor: Fróes, Rogério * FLUSHING SQLData... SCANNING actor: Funaki, Sho SCANNING actor: Fürst, Sigge * FLUSHING SQLData... SCANNING actor: Gagnon, J. Léo SCANNING actor: Gallagher, Noel (II) * FLUSHING SQLData... * FLUSHING PersonsCache... SCANNING actor: Gamboa, Joonee SCANNING actor: Garcia, Bruno (I) * FLUSHING SQLData... SCANNING actor: García-Clamart, Carlos SCANNING actor: Garren, Nicholas * FLUSHING SQLData... SCANNING actor: Gastmann, Constantin SCANNING actor: Gazey, Craig * FLUSHING SQLData... SCANNING actor: Gencebay, Orhan SCANNING actor: Geray, Steven * FLUSHING SQLData... SCANNING actor: Ghira, Alberto SCANNING actor: Giese, Godehard * FLUSHING SQLData... SCANNING actor: Gill, Avtar SCANNING actor: Ginn, Stewart * FLUSHING SQLData... SCANNING actor: Glaser, Paul Michael SCANNING actor: Glover, Michael-Jerred * FLUSHING SQLData... SCANNING actor: Goggins, Walton SCANNING actor: Gomes, Custódio * FLUSHING SQLData... SCANNING actor: González, Carlos A. SCANNING actor: Goodrow, Garry * FLUSHING SQLData... SCANNING actor: Gore II, George SCANNING actor: Gotsis, Elpidoforos * FLUSHING SQLData... SCANNING actor: Grace, Meyer SCANNING actor: Granata, Ubaldo * FLUSHING SQLData... SCANNING actor: Graudus, Konstantin SCANNING actor: Greco, Joel S. * FLUSHING SQLData... SCANNING actor: Greenhalgh, Andy * FLUSHING SQLData... SCANNING actor: Grey, David (I) * FLUSHING CharactersCache... Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2145, in module run() File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2041, in run castLists(_charIDsList=characters_imdbIDs) File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 1212, in castLists doCast(f, roleid, rolename) File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 1171, in doCast cid = CACHE_CID.addUnique(role) File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 679, in addUnique else: return self.add(key, miscData) File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 672, in add self[key] = c File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 589, in __setitem__ self.flush() File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 613, in flush self._toDB(quiet) File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 888, in _toDB CURS.executemany(self.sqlstr, self.converter(l)) File /home/selke/Desktop/imdb/ibm_db/usr/lib/python2.5/site-packages/ibm_db-0.4.1-py2.5-linux-x86_64.egg/ibm_db_dbi.py, line 1063, in executemany self._execute_helper(rows_counter, seq_parameters[index]) File /home/selke/Desktop/imdb/ibm_db/usr/lib/python2.5/site-packages/ibm_db-0.4.1-py2.5-linux-x86_64.egg/ibm_db_dbi.py, line 951, in _execute_helper raise _get_exception(inst) ibm_db_dbi.DataError: ibm_db_dbi::DataError: Statement Execute Failed: [IBM][CLI Driver] CLI0109E String data right truncation. SQLSTATE=22001 SQLCODE=-9 CLI0109E refers to this DB2 error: http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.messages.cli.doc/doc/mcli00109e.html Can you imagine what happened? Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: Seen; I've removed the checkfirst parameter on the dropTable call, if ibm_db is used. It's just a horrible work-around and I hope it doesn't break anything else. :-) By the way, is it safe to call dropTable() if the table doesn't exist, with ibm_db? If not, I assume we've to catch the raised exception, too. :-/ I think this is neccessary. I get an error (latest CVS version): RUNNING imdbpy2sql.py SAVING imdbID values for movies... SKIPPING: no data. SAVING imdbID values for people... SKIPPING: no data. SAVING imdbID values for characters... SKIPPING: no data. SAVING imdbID values for companies... SKIPPING: no data. DROPPING current database... Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2145, in module run() File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2000, in run dropTables(DB_TABLES) File /usr/lib64/python2.5/site-packages/imdb/parser/sql/dbschema.py, line 309, in dropTables File /usr/lib64/python2.5/site-packages/imdb/parser/sql/alchemyadapter.py, line 281, in dropTable File /usr/lib/python2.5/site-packages/sqlalchemy/schema.py, line 375, in drop self.metadata.drop_all(bind=bind, checkfirst=checkfirst, tables=[self]) File /usr/lib/python2.5/site-packages/sqlalchemy/schema.py, line 1610, in drop_all bind.drop(self, checkfirst=checkfirst, tables=tables) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1144, in drop self._run_visitor(self.dialect.schemadropper, entity, connection=connection, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1168, in _run_visitor visitorcallable(self.dialect, conn, **kwargs).traverse(element) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 75, in traverse return self._non_cloned_traversal(obj) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 134, in _non_cloned_traversal self.traverse_single(target) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 35, in traverse_single return meth(obj, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/compiler.py, line 936, in visit_metadata self.traverse_single(table) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 35, in traverse_single return meth(obj, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/compiler.py, line 963, in visit_table self.execute() File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1794, in execute return self.connection.execute(self.buffer.getvalue()) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 844, in execute return Connection.executors[c](self, object, multiparams, params) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 854, in _execute_text self.__execute_raw(context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) sqlalchemy.exceptions.ProgrammingError: (ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N IMDB.PERSON_INFO is an undefined name. SQLSTATE=42704 SQLCODE=-204 '\nDROP TABLE person_info' {} Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 19, Joachim Selke [EMAIL PROTECTED] wrote: I think this is neccessary. I get an error (latest CVS version): Fixed. Now it's all to see if IMDbPY has decent performances on a DB2 server... :-) Thank you again! -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: If you find a way to make it work, let me know, please. I guess I found the problem. Let's have a look at your test case sqla.py again. If I change the lines for value in 'movie', 'tv series', 'tv movie', 'video movie', 'tv mini series', 'video game', 'episode': kt_insert.execute(kind=value) to for value in unicode('movie'), 'tv series', 'tv movie', 'video movie', 'tv mini series', 'video game', 'episode': kt_insert.execute(kind=value) I get the reported error. And indeed, the call of unicode is the important difference between your test case and what IMDbPY is doing (see createTables in dbschema.py). Is this a bug in the ibm_db driver? (My DB2 database's encoding is set to UTF-8 by default.) BTW: I found a problem in your code when creating indexes. In file alchemyadapter.py, class TableAdapter, method _createIndex, indexes are created following the naming convention TABLENAME.COLUMNNAME. In DB2's SQL dialect, names of the type A.B refer to item B contained in schema A of the current database. Therefore, by creating an index named TABLENAME.COLUMNNAME, a new schema TABLENAME is created, which of course is not what we want here. I suggest changing this naming convention to TABLENAME_COLUMNNAME. Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: So... yes, it's probably a good idea to let the ibm_db developers know of this behavior. I just send a message to their mailing list. What if (just to do a fast test) you change this line of the setConnection function: params = {'encoding': encoding} to this one: params = {'encoding': encoding, 'convert_unicode': True} does it works? It does, great! :-) Thanks! I found another issue regarding the use of schemas: I want to create all IMDB stuff (tables, indexes, ...) in a separate schema of my database. Therefore, I pass the schema name within the connection URI: ibm_db_sa://user:[EMAIL PROTECTED]:port/db;CurrentSchema=schema If I do not specify a schema, imdbpy2sql.py works but creates all stuff within the database user's default schema, which is not what I want. But when passing the schema information as in the above URI (schema name is imdb), I get this output: = RUNNING imdbpy2sql.py SAVING imdbID values for movies... SKIPPING: no data. SAVING imdbID values for people... SKIPPING: no data. SAVING imdbID values for characters... SKIPPING: no data. SAVING imdbID values for companies... SKIPPING: no data. DROPPING current database... Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2145, in module run() File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2000, in run dropTables(DB_TABLES) File /usr/lib64/python2.5/site-packages/imdb/parser/sql/dbschema.py, line 309, in dropTables File /home/selke/Desktop/imdb/IMDbPY/usr/lib64/python2.5/site-packages/imdb/parser/sql/alchemyadapter.py, line 277, in dropTable self.table.drop(checkfirst=checkfirst) File /usr/lib/python2.5/site-packages/sqlalchemy/schema.py, line 375, in drop self.metadata.drop_all(bind=bind, checkfirst=checkfirst, tables=[self]) File /usr/lib/python2.5/site-packages/sqlalchemy/schema.py, line 1610, in drop_all bind.drop(self, checkfirst=checkfirst, tables=tables) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1144, in drop self._run_visitor(self.dialect.schemadropper, entity, connection=connection, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1168, in _run_visitor visitorcallable(self.dialect, conn, **kwargs).traverse(element) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 75, in traverse return self._non_cloned_traversal(obj) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 134, in _non_cloned_traversal self.traverse_single(target) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 35, in traverse_single return meth(obj, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/compiler.py, line 936, in visit_metadata self.traverse_single(table) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/visitors.py, line 35, in traverse_single return meth(obj, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/sql/compiler.py, line 963, in visit_table self.execute() File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1794, in execute return self.connection.execute(self.buffer.getvalue()) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 844, in execute return Connection.executors[c](self, object, multiparams, params) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 854, in _execute_text self.__execute_raw(context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) sqlalchemy.exceptions.ProgrammingError: (ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N IMDB.PERSON_INFO is an undefined name. SQLSTATE=42704 SQLCODE=-204 '\nDROP TABLE person_info' {} = Any ideas on that? :-) Thanks, Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 16, Joachim Selke [EMAIL PROTECTED] wrote: params = {'encoding': encoding, 'convert_unicode': True} It does, great! :-) Thanks! I've committed it to the CVS (and removed the connection.set_autocommit call - I assume it's no more needed). I found another issue regarding the use of schemas: I want to create all IMDB stuff (tables, indexes, ...) in a separate schema of my database. [...] Any ideas on that? :-) May it be the ibm_db that doesn't handle it correctly? I'm really not familiar with db's schema, sorry. Anyway, I've never taken 'schema' in consideration, writing IMDbPY, so it's possible a bug on our side. Thanks! -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: Let me know if it works. Unfortunately, it doesn't. Same error as before: RUNNING imdbpy2sql.py SAVING imdbID values for movies... SKIPPING: no data. SAVING imdbID values for people... SKIPPING: no data. SAVING imdbID values for characters... SKIPPING: no data. SAVING imdbID values for companies... SKIPPING: no data. DROPPING current database... DONE! CREATING new tables... Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2145, in module run() File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 2008, in run createTables(DB_TABLES) File /usr/lib64/python2.5/site-packages/imdb/parser/sql/dbschema.py, line 319, in createTables File /usr/lib64/python2.5/site-packages/imdb/parser/sql/alchemyadapter.py, line 315, in __call__ File /usr/lib/python2.5/site-packages/sqlalchemy/sql/expression.py, line 1087, in execute return e.execute_clauseelement(self, multiparams, params) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1219, in execute_clauseelement return connection.execute_clauseelement(elem, multiparams, params) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 895, in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) 1), distilled_params=params) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 907, in _execute_compiled self.__execute_raw(context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) sqlalchemy.exceptions.DatabaseError: (DatabaseError) ibm_db_dbi::DatabaseError: Binding Error: 'INSERT INTO kind_type (kind) VALUES (?)' [u'movie'] Besides that, I fear I'm out of ideas. :-/ Maybe this problem is not related to the autocommit issue at all. What makes you conjecture that it is the cause here? 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, which does exactly the same steps as IMDbPY is doing here (until the error occurs)? I tried to do this by myself but I don't understand the structure of the code very well ... This should be much easier for you. :-) Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
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]:5/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=100url=/___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: 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. Thanks for the code. :-) Well, actually good news is bad news here: The example works as it should (up to the last step of printing the result; I commented out the corresponding two lines): 2008-11-15 15:59:05,818 INFO sqlalchemy.engine.base.Engine.0x..50 CREATE TABLE kind_type ( id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1), kind VARCHAR(15), PRIMARY KEY (id) ) INFO:sqlalchemy.engine.base.Engine.0x..50: CREATE TABLE kind_type ( id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1), kind VARCHAR(15), PRIMARY KEY (id) ) 2008-11-15 15:59:05,818 INFO sqlalchemy.engine.base.Engine.0x..50 {} INFO:sqlalchemy.engine.base.Engine.0x..50:{} 2008-11-15 15:59:06,082 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:06,151 INFO sqlalchemy.engine.base.Engine.0x..50 CREATE INDEX kind_idx ON kind_type (kind) INFO:sqlalchemy.engine.base.Engine.0x..50:CREATE INDEX kind_idx ON kind_type (kind) 2008-11-15 15:59:06,152 INFO sqlalchemy.engine.base.Engine.0x..50 {} INFO:sqlalchemy.engine.base.Engine.0x..50:{} 2008-11-15 15:59:06,613 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:06,740 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:06,740 INFO sqlalchemy.engine.base.Engine.0x..50 ['movie'] INFO:sqlalchemy.engine.base.Engine.0x..50:['movie'] 2008-11-15 15:59:07,055 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:07,175 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:07,175 INFO sqlalchemy.engine.base.Engine.0x..50 ['tv series'] INFO:sqlalchemy.engine.base.Engine.0x..50:['tv series'] 2008-11-15 15:59:07,653 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:07,858 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:07,859 INFO sqlalchemy.engine.base.Engine.0x..50 ['tv movie'] INFO:sqlalchemy.engine.base.Engine.0x..50:['tv movie'] 2008-11-15 15:59:08,182 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:08,495 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:08,495 INFO sqlalchemy.engine.base.Engine.0x..50 ['video movie'] INFO:sqlalchemy.engine.base.Engine.0x..50:['video movie'] 2008-11-15 15:59:08,806 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:08,927 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:08,927 INFO sqlalchemy.engine.base.Engine.0x..50 ['tv mini series'] INFO:sqlalchemy.engine.base.Engine.0x..50:['tv mini series'] 2008-11-15 15:59:09,250 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:09,575 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:09,575 INFO sqlalchemy.engine.base.Engine.0x..50 ['video game'] INFO:sqlalchemy.engine.base.Engine.0x..50:['video game'] 2008-11-15 15:59:09,882 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT 2008-11-15 15:59:09,999 INFO sqlalchemy.engine.base.Engine.0x..50 INSERT INTO kind_type (kind) VALUES (?) INFO:sqlalchemy.engine.base.Engine.0x..50:INSERT INTO kind_type (kind) VALUES (?) 2008-11-15 15:59:09,999 INFO sqlalchemy.engine.base.Engine.0x..50 ['episode'] INFO:sqlalchemy.engine.base.Engine.0x..50:['episode'] 2008-11-15 15:59:10,562 INFO sqlalchemy.engine.base.Engine.0x..50 COMMIT INFO:sqlalchemy.engine.base.Engine.0x..50:COMMIT The table got created and populated with tuples. Even the index has been generated. 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). When doing the last step of printing, the program seems to freeze. Before that happens, I get this output (ignore the
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 15, Joachim Selke [EMAIL PROTECTED] wrote: Well, actually good news is bad news here: The example works as it should [...] When doing the last step of printing, the program seems to freeze. [...] Then, I cannot even abort the program by Ctrl-c. This bug is way to erratic to be spotted, at least for me. :-/ I give up: it can even be a strange behavior of your own DB2 installation, as far as we know. If you want, you can try to summarize the situation (and post some of the tests) in the ibm_db support group: http://groups.google.com/group/ibm_db If you find a way to make it work, let me know, please. Thank you again for your effort! -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: It can be a problem: - in your database (some settings about unicode/collations?). I use a standard installation of DB2 9.5 (latest fixpack) on CentOS 5, which is a binary-compatiable clone of the Red Hat Enterprise Linux. The latter is supported by IBM. Therefore, this shouldn't make any trouble, should it? - in the ibm_db module. - of the ibm_db_sa adapter. I made some more tests. The following code inserts the value successfully: import ibm_db ibm_db_conn = ibm_db.connect('DATABASE=mydb;HOSTNAME=myhost;PORT=myport;PROTOCOL=TCPIP;UID=myuser;PWD=mypass;', '', '') import ibm_db_dbi connection = ibm_db_dbi.Connection(ibm_db_conn) cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) This one does not (based on your code) but also doesn't raise an error: import ibm_db_dbi connection = ibm_db_dbi.connect('DATABASE=mydb;HOSTNAME=myhost;PORT=myport;PROTOCOL=TCPIP;UID=myuser;PWD=mypass;') cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) Does this help? Anyway, a test with SQLAlchemy 0.5 looks like a good idea, now. I tried that but it doesn't help. I get the same error as before (sqlalchemy.exc.DatabaseError: (DatabaseError) ibm_db_dbi::DatabaseError: Binding Error: 'INSERT INTO kind_type (kind) VALUES (?)' [u'movie']) What's next? Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 14, Joachim Selke [EMAIL PROTECTED] wrote: I use a standard installation of DB2 9.5 (latest fixpack) on CentOS 5, which is a binary-compatiable clone of the Red Hat Enterprise Linux. The latter is supported by IBM. Therefore, this shouldn't make any trouble, should it? Let's assume it's ok - it sounds reasonable enough. :-) - in the ibm_db module. - of the ibm_db_sa adapter. I made some more tests. The following code inserts the value successfully: Good; from what I've understood, ibm_db_sa uses the ibm_db_dbi module, and I suppose SQLAlchemy calls the ibm_db_dbi.connect function to get the proper Connection instance. Why it doesn't work in your second test, is well beyond my understanding. :-/ Maybe you can try to debug the ibm_db_dbi.connect function (inserting a print here and there to see if something is blatantly wrong) and/or the ibm_db_dbi.Connection class. I would also try the second test with the ibm_db_dbi.SQL_AUTOCOMMIT_ON argument. After that, I think it's a problem between SQLAlchemy (specifically the ibm_db_sa module) and the ibm_db package. Probably you can search for help in their forum/mailing lists. It may be a thing you can fix just passing some extra parameter to the connect function (if this is the case, I can fix it in IMDbPY). Anyway, a test with SQLAlchemy 0.5 looks like a good idea, now. I tried that but it doesn't help. I see; moreover I've noticed that ibm_db_sa was done with SQLAlchemy 0.4 in mind, so you should consider a downgrade (I assume it will be already difficult enough to nail the problem without using incompatibles versions. ;-) Thanks! -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Davide Alberani wrote: I would also try the second test with the ibm_db_dbi.SQL_AUTOCOMMIT_ON argument. You're right. This indeed works: import ibm_db_dbi connection = ibm_db_dbi.connect('DATABASE=mydb;HOSTNAME=myhost;PORT=myport; PROTOCOL=TCPIP;UID=myuser;PWD=mypass;', conn_options={ibm_db_dbi.SQL_ATTR_AUTOCOMMIT : ibm_db_dbi.SQL_AUTOCOMMIT_ON}) cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) Can I pass this option somehow to IMDbPY within the connection URI? Thanks for the help, :-) Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Davide Alberani wrote: Can I pass this option somehow to IMDbPY within the connection URI? I'm not sure it should not be considered an ibm_db_sa glitch, but anyway: try the IMDbPY version in the cvs repository. I get this error: Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 254, in module conn = setConnection(URI, DB_TABLES) File /usr/lib64/python2.5/site-packages/imdb/parser/sql/alchemyadapter.py, line 404, in setConnection File /usr/lib/python2.5/site-packages/sqlalchemy/engine/__init__.py, line 160, in create_engine return strategy.create(*args, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/strategies.py, line 121, in create engineclass.__name__)) TypeError: Invalid argument(s) 'conn_options' sent to create_engine(), using configuration IBM_DBDialect/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components. If it doesn't work, see if you can fix it: this specific case is handled in the setConnection function of the parser.sql.alchemyadapter module. The above error can be fixed by changing conn_options to connect_args in line 401 of alchemyadapter.py. But then I get: Traceback (most recent call last): File /home/selke/Desktop/imdb/IMDbPY/usr/bin/imdbpy2sql.py, line 254, in module conn = setConnection(URI, DB_TABLES) File /home/selke/Desktop/imdb/IMDbPY/usr/lib64/python2.5/site-packages/imdb/parser/sql/alchemyadapter.py, line 406, in setConnection eng_conn = engine.connect() File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1231, in connect return Connection(self, **kwargs) File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 538, in __init__ self.__connection = connection or engine.raw_connection() File /usr/lib/python2.5/site-packages/sqlalchemy/engine/base.py, line 1286, in raw_connection return self.pool.unique_connection() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 142, in unique_connection return _ConnectionFairy(self).checkout() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 323, in __init__ rec = self._connection_record = pool.get() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 180, in get return self.do_get() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 615, in do_get con = self.create_connection() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 145, in create_connection return _ConnectionRecord(self) File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 217, in __init__ self.connection = self.__connect() File /usr/lib/python2.5/site-packages/sqlalchemy/pool.py, line 280, in __connect connection = self.__pool._creator() File /usr/lib/python2.5/site-packages/sqlalchemy/engine/strategies.py, line 80, in connect raise exceptions.DBAPIError.instance(None, None, e) sqlalchemy.exceptions.DBAPIError: (TypeError) connect() keywords must be strings None None Unfortunately, I have no idea how this can be fixed ... Do you have one? Anyway, I made some more tests to get myself accustomed to SQLAlchemy and the DB2 module. The following passages of code all successfully insert the data for our test case. Maybe you get some ideas by looking at it: import ibm_db_dbi connection = ibm_db_dbi.connect(XXX, conn_options={ibm_db_dbi.SQL_ATTR_AUTOCOMMIT : ibm_db_dbi.SQL_AUTOCOMMIT_ON}) cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) import ibm_db_dbi connection = ibm_db_dbi.connect(XXX) cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) connection.commit() import ibm_db_dbi connection = ibm_db_dbi.connect(XXX) connection.set_autocommit(True) cursor = connection.cursor() cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) import sqlalchemy engine = sqlalchemy.create_engine(XXX) conn = engine.connect() conn.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) BTW: If you need access to a DB2 database for debugging purposes, I can create you an account on our database ... Just let me know. :-) Joachim - -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkdsAkACgkQLkSNdE3JDbA0+wCfRgAjm5AxzHNxBIUIdOnphDPQ lCQAnAwJ5stVksKjSVCfHvH8fk0UXrMY =qtuv -END PGP SIGNATURE- - 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
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
On Nov 14, Joachim Selke [EMAIL PROTECTED] wrote: The above error can be fixed by changing conn_options to connect_args in line 401 of alchemyadapter.py. Fine, but... I'm about to cry. ;-) But then I get: [...] sqlalchemy.exceptions.DBAPIError: (TypeError) connect() keywords must be strings None None My guess is that sqlalchemy's connect function isn't happy with dictionaries as parameters. Anyway: here you're using SQLAlchemy 0.4, right? But I have a Plan B: try, in alchemyadapter.setConnection, to replace the code of the if uri.startswith('ibm_db') statement with only: # I really do hope to have used the right numer of connection ;-) connection.connection.set_autocommit(True) Moving everything _after_ the line: connection.module = eng_conn.dialect.dbapi Unfortunately, I have no idea how this can be fixed ... Do you have one? I admit there's a lot of empiricism at work, here. :-) import sqlalchemy engine = sqlalchemy.create_engine(XXX) conn = engine.connect() conn.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) The above test scary me: I really can't think of a reason why it works, failing in IMDbPY: after all we're just creating the engine (create_engine), binding it to the metadata and then connecting... BTW: If you need access to a DB2 database for debugging purposes, I can create you an account on our database ... Just let me know. :-) Right now I hope it would not be necessary, but thanks! :-) -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
Joachim Selke wrote: sqlalchemy.exceptions.DatabaseError: (DatabaseError) ibm_db_dbi::DatabaseError: Binding Error: 'INSERT INTO kind_type (kind) VALUES (?)' [u'movie'] I also tried connection.set_autocommit(True) but it did not change anything. I also do not get an error message, although this command definitely gets executed (I verified this with a print command right after the autocommit statement). Just to give a short update: Maybe you are suspecting the problem to be at the wrong place. I tried to reconstruct what IMDbPY does when creating and using a cursor: class _AlchemyConnection(object): A proxy for the connection object, required since _ConnectionFairy uses __slots__. def __init__(self, conn): self.conn = conn def __getattr__(self, name): return getattr(self.conn, name) import sqlalchemy engine = sqlalchemy.create_engine('XXX') eng_conn = engine.connect() connection = _AlchemyConnection(eng_conn.connection) connection.set_autocommit(True) CURS = connection.cursor() CURS.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) This works like a charm (no matter whether it is connection or connection.connection), whereas it doesn't work if I remove the autocommit line completely. Thus, autocommit definitely is enabled when I make the modification to setConnection as you suggested. Joachim -- M. Sc. Joachim Selke Technische Universität Braunschweig, Institut für Informationssysteme Mühlenpfordtstraße 23, 38106 Braunschweig, Germany http://www.l3s.uni-hannover.de/~selke - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel
Re: [Imdbpy-devel] Bug: imdbpy2sql.py and DB2 9.5
First of all: is anyone out there who has successfully used IMDbPY with DB2 or - at least - knows how to use the ibm_db module? On Nov 13, Joachim Selke [EMAIL PROTECTED] wrote: Here are the results: [...] cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ['movie']) No error, but the table is still empty. cursor.execute('INSERT INTO kind_type (kind) VALUES (?)', ('movie',)) No error, but the table is still empty. Hm, what to do next? Upgrade to SQLAlchemy 5? It's a thing to try, at least. In the above tests we weren't using SQLAlchemy, but directory the SQL query it built. For some reason, the query seems to be wrong. It can be a problem: - in your database (some settings about unicode/collations?). - in the ibm_db module. - of the ibm_db_sa adapter. - of SQLAlchemy, in case it built a wrong query. Right now I tend to exclude an IMDbPY problem, but who knows... The first thing, is to understand how you can insert a valid set of values in the DB2 database with the ibm_db module (how is the documentation?): maybe we're calling cursor.execute with the wrong style/paramters, or maybe you set up the connection to the database with the wrong parameters (can you read data from an existing database?); after that we should know if SQLAlchemy is creating a correct query. Anyway, a test with SQLAlchemy 0.5 looks like a good idea, now. Thank you very much! -- Davide Alberani [EMAIL PROTECTED] [PGP KeyID: 0x465BFD47] http://erlug.linux.it/~da/ - 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=100url=/ ___ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel