Subject sqlalchemy.exceptions.OperationalError: (OperationalError) (-901, 'begin transac
Author opusroyalla
Hello,

Brand new to Firebird and having some problems using SqlAlchemy and
Python.

Built a Firebird database and having no problems in using it with
FlameRobin and ODBC. However I trying to build and app using Python
with SqlAlchemy/kinterbasdb.

Relevant details include:
Windows XP
Firebird 2.1
SqlAlchemy 0.4.6
kinterbasdb 3.2
Python 2.5

I am simply trying to connect to my database and select a table with
the following script:

#-----------------------------------------------------------------
from sqlalchemy import *

db = create_engine('firebird:///../Database/FOOTBALLMANAGER.FDB')
db.echo = True
metadata = MetaData()
metadata.bind = db
Ground = Table('GROUND', metadata, autoload=True)
Result = Ground.select().execute()
#-----------------------------------------------------------------

Results in the following:

2008-05-31 22:43:31,030 INFO sqlalchemy.engine.base.Engine.0x..10
SELECT se.rdb$field_name AS fname
FROM rdb$relation_constraints rc
JOIN rdb$index_segments se ON
rc.rdb$index_name=se.rdb$index_name
WHERE rc.rdb$constraint_type=? AND rc.rdb$relation_name=?

2008-05-31 22:43:31,030 INFO sqlalchemy.engine.base.Engine.0x..10
['PRIMARY KEY', 'GROUND']
2008-05-31 22:43:31,046 INFO sqlalchemy.engine.base.Engine.0x..10
ROLLBACK
Traceback (most recent call last):
File "C:\Documents and Settings\Rob\My
Documents\Eclipse\Workspace\FootballManager\src\FootBallManager\Main.p
y", line 7, in <module>
Ground = Table('GROUND', metadata, autoload=True)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\schema.py", line 110, in __call__
return type.__call__(self, name, metadata, *args, **kwargs)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\schema.py", line 226, in __init__
_bind_or_error(metadata).reflecttable(self,
include_columns=include_columns)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 1275, in reflecttable
self.dialect.reflecttable(conn, table, include_columns)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\databases\firebird.py", line 457, in reflecttable
c = connection.execute(keyqry, ["PRIMARY KEY", tablename])
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 844, in execute
return Connection.executors[c](self, object, multiparams, params)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 854, in _execute_text
self.__execute_raw(context)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 916, in __execute_raw
self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 960, in _cursor_execute
self._handle_dbapi_exception(e, statement, parameters, cursor)
File "c:\program files\python25\lib\site-packages\sqlalchemy-0.4.6-
py2.5.egg\sqlalchemy\engine\base.py", line 942, in
_handle_dbapi_exception
raise exceptions.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
sqlalchemy.exceptions.OperationalError: (OperationalError) (-
901, 'begin transaction: \n invalid parameter in transaction
parameter block') '\n SELECT se.rdb$field_name AS
fname\n FROM rdb$relation_constraints rc\n JOIN
rdb$index_segments se ON rc.rdb$index_name=se.rdb$index_name\n
WHERE rc.rdb$constraint_type=? AND rc.rdb$relation_name=?\n '
['PRIMARY KEY', 'GROUND']



I have looked up the -901 error code but it does not really tell me
anything to help resolve the problem.

Can anyone explain or help?

Thanks