Closed zzzeek closed 6 years ago
Original comment by Michael Bayer (Bitbucket: zzzeek, GitHub: zzzeek):
hey there -
BoundMetaData
is made against an Engine
, not a Connection
:
from sqlalchemy import *
en = create_engine('postgres://bladf:alfsdf@host.domain:5432/mydb')
md = BoundMetaData(en)
table1 = Table('meta_document',md,autoload=True)
http://www.sqlalchemy.org/docs/metadata.myt#metadata_tables_binding
thanks for your interest, and good luck !
Originally reported by: Anonymous
hi guys!!
I am just checking out SQLAlchemy, but I don't get far because of a bug(??). my system: 0.2.5 (release), postgres (8.1), psycopg2/2.0.2, Linux 2.6.17.3 SMP, Debian
What I did:
$ python
from sqlalchemy import *
en = create_engine('postgres://bladf:alfsdf@host.domain:5432/mydb')
db = en.connnect()
md = BoundMetaData(db)
table1 = Table('meta_document',md,autoload=True)
s = table1.select()
<sqlalchemy.sql.Select object at 0xb7885bcc>
Traceback (most recent call last):
File "", line 1, in ?
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 511, in str
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 502, in compile
AttributeError: 'Connection' object has no attribute 'compiler'
Traceback (most recent call last):
File "", line 1, in ?
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 514, in execute
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 468, in execute_using
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 500, in compile
AttributeError: 'Connection' object has no attribute 'compiler'
hmm, did I do something wrong, or is this a bug? how can I fix it asap, because I would like to use sqlalchemy in a project ...
thanks for your help!!!
cheers, gerhard/austria
wohlg AT wu-wien.ac dot at