[sqlalchemy] In-memory sqlite database to blob?

2011-03-04 Thread thatsanicehatyouhave
Hi,

I'd like to write a script that creates an in-memory SQLite database via 
SQLAlchemy, but when I've finished with it I'd like to upload it as a file to a 
server, preferably without ever creating a temporary file on the client side. 
Is this possible?

Cheers,
Demitri

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] In-memory sqlite database to blob?

2011-03-04 Thread Michael Bayer
you can ATTACH the memory database to a file and then transfer tables using 
insert-from-select.Don't think there's a way to go straight to a stream, 
though.


On Mar 4, 2011, at 4:50 PM, thatsanicehatyouh...@mac.com wrote:

 Hi,
 
 I'd like to write a script that creates an in-memory SQLite database via 
 SQLAlchemy, but when I've finished with it I'd like to upload it as a file to 
 a server, preferably without ever creating a temporary file on the client 
 side. Is this possible?
 
 Cheers,
 Demitri
 
 -- 
 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 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] In-memory sqlite database to blob?

2011-03-04 Thread A.M.

On Mar 4, 2011, at 4:50 PM, thatsanicehatyouh...@mac.com wrote:

 Hi,
 
 I'd like to write a script that creates an in-memory SQLite database via 
 SQLAlchemy, but when I've finished with it I'd like to upload it as a file to 
 a server, preferably without ever creating a temporary file on the client 
 side. Is this possible?

It is possible but potentially difficult. You could accomplish this by using 
the backup facility (sqlite3_backup_*) to push the in-memory database to the 
remote location, perhaps over a network-mounted file share. 
(http://www.sqlite.org/backup.html)

It would likely be easier to use iterdump in pysqlite to generate a database 
dump and push the SQL dump text to a server.

If you are trying to avoid hitting the disk, perhaps you can create the sqlite 
db on an in-memory filesystem. Then you could use normal filesystem operations 
to manipulate the resultant database.

In any case, SQLAlchemy won't be directly helpful here.

Cheers,
M


-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] In-memory sqlite database to blob?

2011-03-04 Thread thatsanicehatyouhave

Thanks for the pointers. I'l probably just write it to a file initially to keep 
it simple!

Cheers,
Demitri

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.