How to set up global connect to datebase in pylons(python), sqlalchemy.

Posted by gummmibear on Stack Overflow See other posts from Stack Overflow or by gummmibear
Published on 2010-04-08T20:09:20Z Indexed on 2010/04/08 20:13 UTC
Read the original article Hit count: 249

Filed under:
|

Hi!

I just start lern python, pylons.

i have problem with setting up datebase connection.

i won't to set connection, where i can see this connection in all my controllers.

Now i use: some thing like this in my controller:

 45 '   db = create_engine('mysql://root:password@localhost/python')
 46 '   metadata = MetaData(db)
 47 
 48 '   email_list = Table('email',metadata,autoload=True)

in development.ini i have: 44 sqlalchemy.url = mysql://root@password@localhost/python 45 sqlalchemy.pool_recycle = 3600

and now, pleas help me to set __init__.py

© Stack Overflow or respective owner

Related posts about sqlalchemy

Related posts about pylons