[Zope3-Users] Re: SqlAlchemy
catonano
adriano at euma.com
Wed Oct 18 16:59:33 EDT 2006
Jurgen,
>> >>>engineUtility =
>> AlchemyEngineUtility('tender','mysql:///root@localhost',echo=False)
>>
>> >>>listaparti = sqlalchemy.Table('listaparti',
>> z3c.zalchemy.metadata, autoload = True)
>>Traceback (most recent call last):
>> File "<input>", line 1, in ?
>> File "build\bdist.win32\egg\sqlalchemy\schema.py", line 138, in __call__
>>AttributeError: 'NoneType' object has no attribute 'reflecttable'
>>
>>If I try without the autoload argument, it doesn't claim anything
>>and gives me the prompt back
>Hm, I never tried this.
>Have you tried the same without zalchemy ?
Of course ! It's for SqlAlchemy to discover the fields of a table on its own !
Here it is !
>>> from sqlalchemy import *
>>> db = create_engine('mysql://root:speranza@localhost/tender')
>>> metadata = BoundMetaData(db)
>>> listaparti = Table('listaparti', metadata, autoload = True)
>>> listaparti.columns.keys()
['childid', 'id', 'parentid', 'quantita', 'unitadimisura']
>>>
And it's so cute when you create a table like that and then you ask
for the columns list and you find them all there !
In my case the data base is already existing, I'm trying to provide
an alternative access to a database used by a php based framework !
What's missing, I think, is the BoundMetaData method from sqlalchemy
>> >>>listaparti = sqlalchemy.Table('listaparti', z3c.zalchemy.metadata)
>> >>>
>>
>>But I'd LOVE it to discover the tables on its own !
>>Was I right when I took the trunk one?
>You are right to take the trunk.
Ok, thanks.
I'll see if I am able to help you to introduce this functionality
Thanks SO much
Bye
Catonano
More information about the Zope3-users
mailing list