On 4/4/15 4:10 PM, Duke Dougal wrote:
> OK I'll try again, apologies for not being clear.
>
> I want to connect to a Sqlite database if it exists, but if it does
> not exist, I want to execute my custom database creation code., which
> looks like this:
then use Python to check for the file:

import os
if not os.path.exists("myfile.db"):
    # do thing





>
> def setupArchiveTables(db):
>
>     import sqlite3
>     conn = sqlite3.connect('/home/ubuntu/archives.db')
>     with open('serve_spec_archives/schema.sql') as f:
>         conn.executescript(f.read())
>     conn.commit()
>
> And then after the database has been created, try again to connect to
> it so I can proceed with using it via SQLAlchemy.
>
> Is that possible?
>
> thanks
>
>
>
> -- 
> 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
> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
> To post to this group, send email to sqlalchemy@googlegroups.com
> <mailto:sqlalchemy@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.

Reply via email to