[sqlalchemy] Re: SA support for SQLite ATTACH?
Thanks it is nice post. I also refer very useful and helpful article about SQLite - ATTACH DATABASE Please visit this helpful article. http://www.mindstick.com/blog/10947/SQLite%20ATTACH%20DATABASE#.VffLzhFViko http://www.tutorialspoint.com/sqlite/sqlite_attach_database.htm -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: SA support for SQLite ATTACH?
I tried the following: import sqlalchemy as SA md_dbA=SA.BoundMetaData('dbA') tbl_dbAtbl=SA.Table('dbAtbl',md_dbA,autoload=True) SA.text(ATTACH DATABASE 'C:Temp\dbB.db' as dbB_db) tbl_dbBtbl=SA.Table('dbB_db.dbBtbl',md_dbA,schema='dbB_db',autoload=True) === The code fails on the line marked above. Did I mis-understand what you said? Also, how do I look at the echoed SQL for text function? On Apr 30, 9:07 am, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2007, at 8:13 AM, VN wrote: you might need to use a Table with a schema='dbA_db', just a guess. look at the echoed sql and see if it matches things that work at the sqlite console. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA support for SQLite ATTACH?
I tried the following: import sqlalchemy as SA md_dbA=SA.BoundMetaData('dbA') tbl_dbAtbl=SA.Table('dbAtbl',md_dbA,autoload=True) SA.text(ATTACH DATABASE 'C:Temp\dbB.db' as dbB_db) tbl_dbBtbl=SA.Table('dbB_db.dbBtbl',md_dbA,schema='dbB_db',autoload=True) === The code fails on the line marked above. Did I mis-understand what you said? Also, how do I look at the echoed SQL for text function? On Apr 30, 9:07 am, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2007, at 8:13 AM, VN wrote: you might need to use a Table with a schema='dbA_db', just a guess. look at the echoed sql and see if it matches things that work at the sqlite console. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA support for SQLite ATTACH?
attach database ...wow i never knew it had that ! if its a matter of issuing the string attach database, just use literal text() or engine.execute(). attach databasevery handy ! On Mar 9, 9:43 am, Karlo Lozovina [EMAIL PROTECTED] wrote: Greetings everyone, does SQLAlchemy somehow support SQLites' ATTACH DATABASE statement? I have a in-memory SQLite database that I want to dump to file, so I was thinking of using ATTACH to do it. Any other ideas welcome ;). Thanks in advance, Karlo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA support for SQLite ATTACH?
On Mar 9, 4:33 pm, Michael Bayer [EMAIL PROTECTED] wrote: attach database ...wow i never knew it had that ! if its a matter of issuing the string attach database, just use literal text() or engine.execute(). Me neither ;), until the other day I started looking for an efficient way to dump in-memory SQLite databases to hdd. And this ATTACH thing sounded just like made for it. attach databasevery handy ! So, let's say I issue this engine.execute(), how would one proceede inserting rows into this attached database. Let's say mem_db is the main, in-memory database, and file_db has just been attached, and is a in-file database. SQL syntax is somewhat like this: INSERT INTO file_db.table1 SELECT * FROM mem_db.table1, is any way SQLAlchemy can do this without resorting to engine.execute() ? Thanks! Karlo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA support for SQLite ATTACH?
OK, just read over ATTACH, you issue the ATTACH DATABASE command textually. from that point on, the tables in that database are accessible using a schemaname syntax (i.e. schemaname.tablename). if you really want to just copy tables wholesale, yeah youd have to issue INSERT ... SELECT statements which also would have to be texual at this point. other operations can be done if you define Table objects with schema=whatever, and you can also use autoload=True to read them in for you. On Mar 9, 2007, at 2:12 PM, Karlo Lozovina wrote: On Mar 9, 4:33 pm, Michael Bayer [EMAIL PROTECTED] wrote: attach database ...wow i never knew it had that ! if its a matter of issuing the string attach database, just use literal text() or engine.execute(). Me neither ;), until the other day I started looking for an efficient way to dump in-memory SQLite databases to hdd. And this ATTACH thing sounded just like made for it. attach databasevery handy ! So, let's say I issue this engine.execute(), how would one proceede inserting rows into this attached database. Let's say mem_db is the main, in-memory database, and file_db has just been attached, and is a in-file database. SQL syntax is somewhat like this: INSERT INTO file_db.table1 SELECT * FROM mem_db.table1, is any way SQLAlchemy can do this without resorting to engine.execute() ? Thanks! Karlo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---