-----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 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