On 20 Sep 2013, at 08:15, monosij.for...@gmail.com wrote:

> 
> I am trying to create multiple tables from a set of 'create table' 
> scripts.The set of scripts are in a list and I am executing as below.
> 
> The scripts create tables, all scripts tested and work through the sqlite3 
> driver fine - one at a time.
> 
> However, through the sqlarchemy driver when I try as below - only a few of 
> the tables get created, ie the script gets executed.
> 
> The scripts (for the tables) always come in the same order but randomly a few 
> gets executed, somes 1st,2nd or 1st,3rd; etc.
> 
> The same scripts iterated from the same list get created fine using sqlite3 
> driver as mentioned, with no issues.
> 
> However only a few of the tables get when I try the following, and then there 
> is an error which causes the rollback from the script that failed and it 
> exits.
> 
> Any suggestions will be very appreciated as I actually plan to use the 
> scripts for Postgres eventually.
> 
> Btw I also try executing them all together by trying to execute the list - 
> that also failed. Eventually i would like to try and bulk execute if 
> possible, but not urgent for 'create table'
> 
> Thank you for your help.
> 
> Mono
> 
> ...
> dbms = 'sqlite:////dataSpace/sqlite3/test.sqlite3' 
> engine = create_engine(dbms, echo = True) 
> t = conn.begin() 
> try: 
>     for script in scripts: 
>         print (script) 
>         conn.execute(script)   # I tried executing scripts all together as 
> well but failed.
>         t.commit()    # I tried commit outside the for as well
>     executed = True 
> except: 
>     t.rollback()
> …
> 

If your script really looks like this, then you are suppressing any error 
messages that might be happening during the import with your "except" clause. 
Trying putting a bare "raise" after the t.rollback() so that your script aborts 
after an exception.

Simon

-- 
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/groups/opt_out.

Reply via email to