Hi Craig,
Yes, it is exactly what I was looking for.
Thanks a lot.
j


Craig Small wrote:
On Fri, Oct 28, 2011 at 03:44:09PM +0200, jo wrote:
I'm trying to write a script to access to PostgreSQL and Oracle, like this:
I'm not sure why you are doing it, but I have a situation where I have
to open one database directly and use the "normal" tg database at the
same time.  It's basically a migration or import script to take the old
database and convert it to a TG app.

The old database is opened like:

old_db = sqlalchemy.create_engine(sqlalchemy.engine.url.URL('dbtype',
   username='dbuser',password='dbpass', host='dbhost', database=('dbname')))
old_conn = old_db.connect()

Then to move from one to the other:

result = old_conn.execute("SELECT whatever FROM whatever etc")
    for row in result:
      blah = model.Blah(row[1], row[3], etc etc)
      model.DBSession.add(blah)

It might be completely off-track to what you are after. To have two
sessions running at the same time, my guess is you need to make two
DBSession objects.

 - Craig



--
Jose Soares
Sferacarta Net Via Bazzanese 69
40033 Casalecchio di Reno
Bologna - Italy
Ph  +39051591054
fax +390516131537
web:www.sferacarta.com

Le informazioni contenute nella presente mail ed in ogni eventuale file 
allegato sono riservate e, comunque, destinate esclusivamente alla persona o 
ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. La 
diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di 
qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza, 
l’integrità e la sicurezza della presente mail non possono essere garantite. Se 
avete ricevuto questa mail per errore, Vi preghiamo di contattarci 
immediatamente e di eliminarla. Grazie.

This communication is intended only for use by the addressee, pursuant to 
legislative decree 30 June 2003, n. 196. It may contain confidential or 
privileged information. You should not copy or use it to disclose its contents 
to any other person. Transmission cannot be guaranteed to be error-free, 
complete and secure. If you are not the intended recipient and receive this 
communication unintentionally, please inform us immediately and then delete 
this message from your system. Thank you.

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to