Hello. I want to use an existing (legacy) db in firebird with TG2.
First I did it in TG1 with success I insert data in one table. So,
connection, kinterbasdb, etc worked ok. Thank to this post in this
same group: http://is.gd/85YLB
Now I want to do it in TG2, just because I want to learn and at same
time, show its power to my chiefs :)
bd is in: C:/Archivos de programa/DRoster/DROSTER.gdb
My project is called tg2roster.
so I put this in development.ini:
sqlalchemy.url = firebird://sysdba:master...@localhost:3050/C:/Archivos
de programa/DRoster/DROSTER.gdb
(tg2env) D:\desarrollos\tg2env\tg2roster>paster setup-app
development.ini
Running setup_config() from tg2roster.websetup
Creating tables
Successfully setup
This shows me that configuration is ok, or not?
db table's name is person
PERSON
Field Type NULL
PERSON_ID Integer not null
PERSON_NAME Varchar(100)
ADDRESS Varchar(200)
PHONE_HOME Varchar(15)
PHONE_MOBILE Varchar(15)
NOTE Varchar(500)
fields goes on, but I wanted to show some.
Then, I just copy and paste tables definition from model in tg1 to
model.py in tg2:
This model.py is inside ..\tg2roster\tg2roster\model\
from sqlalchemy import *
from sqlalchemy.orm import mapper, relation
from sqlalchemy import Table, ForeignKey, Column
from sqlalchemy.types import Integer, Unicode
from tg2roster.model import DeclarativeBase, metadata, DBSession
person_table = Table('person', metadata, autoload=True)
class Person(object):
pass
mapper(Person, person_table)
Now, I use shell to get/set data:
(tg2env) D:\desarrollos\tg2env\tg2roster>paster shell development.ini
And this is the error:
>>> from tg2roster.model import model
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\desarrollos\tg2env\tg2roster\tg2roster\model\model.py",
line 29, in <module>
person_table = Table('person', metadata, autoload=True)
File "d:\desarrollos\tg2env\lib\site-packages\sqlalchemy-0.5.1-
py2.5.egg\sqlalchemy\schema.py", line 113, in __call__
return type.__call__(self, name, metadata, *args, **kwargs)
File "d:\desarrollos\tg2env\lib\site-packages\sqlalchemy-0.5.1-
py2.5.egg\sqlalchemy\schema.py", line 241, in __init__
_bind_or_error(metadata).reflecttable(self,
include_columns=include_columns)
File "d:\desarrollos\tg2env\lib\site-packages\sqlalchemy-0.5.1-
py2.5.egg\sqlalchemy\schema.py", line 2146, in _bind_or_error
raise exc.UnboundExecutionError(msg)
UnboundExecutionError: The MetaData is not bound to an Engine or
Connection. Execution can not proceed without a database to execute
against. Either execute with an explicit connection or assign the
MetaData's .bind to enable implicit execution.
>>>
Did you know where is the problem? What to do? What to read? I
couldn't find much information about firebird/legacy/turbogears2 on
the web.
I want to learn about using legacy db with turbogears, do you know for
something to read?
Thanks in advance
Matigro
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.