Hello again,
So now that I have mssql connection ready and data filtered out and
processed I need to save it to a different database.
mssql -> process data -> save to mysql
I am wondering how should I create a second database connection? In
second database I will create a table and populate the records.
# First database
e = sqlalchemy.create_engine("mssql://user:[EMAIL
PROTECTED]:1433/dbname?driver=TDS&odbc_options='TDS_Version=8.0'")
#e.echo=True
metadata=sqlalchemy.MetaData(e)
#session stuff
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=e, autoflush=True, transactional=True)
session = Session()
#table stuff
class th(object):
pass
th_table = sqlalchemy.Table('xxxx', metadata, autoload=True)
mapper(th,th_table)
# database number 2. Is this the way I should create second database
connection/session/mapper?
e2 = sqlalchemy.create_engine('mysql://user:[EMAIL PROTECTED]/dbname')
Do I create new metadata?
metadata2=sqlalchemy.MetaData(e2)
And then new session2?
Session2 = sessionmaker(bind=e2, autoflush=True, transactional=True)
What does this line do?
session = Session()
Is the above correct way of doing this?
I would like to keep these connections separate so there will be no
confusion of what I am using.
Thanks,
Lucas
--
Automotive Recall Database. Cars, Trucks, etc.
http://www.lucasmanual.com/recall/
TurboGears Manual-Howto
http://lucasmanual.com/pdf/TurboGears-Manual-Howto.pdf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---