McA wrote:
> Hi all,
>
> I'm intersted in using sqlalchemy and started to read the manuals.
> I didn't find a hint for my question, so I'm asking here. I hope it's
> not too annoying.
>
> Most code examples in the documentation use something like this
>   
>>> >from sqlalchemy.XXXX import YYYY
>>>       
>
> My question is: Is this the good/proper way to import the sqlalchemy
> stuff.
> I'm concerned about polluting the current namespace. I could assume
> that
> class names like 'Table' are too common to reserve them for the
> sqlalchemy
> classes.
>
> What would you recommend? How are the gurus out there using
> sqlalchemy?
>   
Warning: I am not a guru (not even close)

I use SA behind a module eg. database.py  in my projects.

so in database.py, import

import sqlalchemy as sa
from sqlalchemy import Table, etc.etc.

and throughout my project i use my database.py like

from myproject import database as db

then

db.Table()... etc. etc.

I also provide wrappers around the most common SA methods like select, 
flush, session etc in my database.py eg.

in database.py

def select(*args, **kws):
   return sa.select(*args, **kws)

I have found my projects to be more resilient to SA api changes and a 
breeze to ugprade i.e only changes in database.py required.

Huy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to