I am writing a bit of code to dump data from one db into another one.
Basic structure of the db's are the same, one is in FB 2.1 format and
the other other in FB 2.5 format and all primary keys are BIGINT instead
of INTEGER.
I am still on 0.5.8 and using "reversed(meta.sorted_tables)" doesn't
give me the right order of the tables they don't seem to be in order of
dependency, so wanted to try out 0.6.3 to see if this is different but I
run into an exception I can't figure out.
Following is an excerpt of my code (I hope I included all what is needed
in relation to the exception).
engine = db.sa.create_engine(dburl, encoding='utf8', echo=False)
connection = engine.connect()
Session = db.sao.sessionmaker()
Session.configure(bind=engine)
session = Session()
meta = db.sa.MetaData()
meta.reflect(bind=engine)
for table in reversed(meta.sorted_tables):
print table
"db" above is my model, relevant code to the exception is:
import sys
if not hasattr(sys, 'frozen'):
import pkg_resources
pkg_resources.require("sqlalchemy") # get latest version
## pkg_resources.require("sqlalchemy==0.5.8") # get specific version
import sqlalchemy as sa
import sqlalchemy.orm as sao
import sqlalchemy.ext.declarative as sad
import sqlalchemy.exc as saexc
import datetime
class BaseExt(object):
def __repr__(self):
return "%s(%s)" % (
(self.__class__.__name__),
', '.join(["%s=%r" % (key, getattr(self, key))
for key in sorted(self.__dict__.keys())
if not key.startswith('_')]))
Base = sad.declarative_base(cls=BaseExt)
metadata = Base.metadata
and all my table definitions.
I get the following exception with 0.6.3, with 0.5.8 it runs o.k.
Traceback (most recent call last):
File "saTest.py", line 37, in <module>
meta.reflect(bind=engine)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\schema.py",
line 1950, in reflect
Table(name, self, **reflect_opts)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\schema.py",
line 209, in __new__
table._init(name, metadata, *args, **kw)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\schema.py",
line 257, in _init
include_columns=include_columns)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\engine\base.py",
line 1776, in reflecttable
self.dialect.reflecttable(conn, table, include_columns)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\engine\default.py",
line 217, in reflecttable
return insp.reflecttable(table, include_columns)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\engine\reflection.py",
line 376, in reflecttable
for col_d in self.get_columns(table_name, schema, **tblkw):
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\engine\reflection.py",
line 223, in get_columns
**kw)
File "<string>", line 1, in <lambda>
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\engine\reflection.py",
line 40, in cache
ret = fn(self, con, *args, **kw)
File
"c:\python26\lib\site-packages\sqlalchemy-0.6.3-py2.6.egg\sqlalchemy\dialects\firebird\base.py",
line 578, in get_columns
defexpr
AssertionError: Unrecognized default value: default -1
Appreciate any hints on how to correct this.
Werner
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.