Re: [pysqlite] Can you restore/import from a .sql file?

Roger Binns <[email protected]> Fri, 20 Feb 2009 13:30:27 -0800
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Al Schmeer wrote:
> But how do I "import" what was created in my test.sql file?  The code 
> below does not work.
>         self.cur.executescript('c:/Python/Apps/ComicDB/test.sql')

executescript takes the sql statements themselves:

self.cur.executescript(open('c:/Python/Apps/ComicDB/test.sql',
                            'r').read())

> Does this mean it is now a database in memory?
> Is there a way to save this to a database (.db) file?

It is applied to the main database (ie whatever you called connect on).

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkmfIO4ACgkQmOOfHg372QSHbACgtf/z2/w823JiVhtXWkKe0oK4
fa0An1kbjp2ONCXAL3ofrnJ51Sk7C/Ay
=Vlok
-----END PGP SIGNATURE-----