Hi,
i tried suggested in other thread way of inserting many records into
database table and it raised exception against postgres (psycopg2)
using the latest trunk (r3412) of SA. Then i checked that in version
0.3.10 same(analogical) code works. Please tell me if there is
something wrong with my usage of the 0.4 version of SA if this is not
a bug.
regards,
stefan
the sample code is below:
###----------------------------
from sqlalchemy import *
from sqlalchemy.orm import *
#db_sqlite = create_engine( 'sqlite:///testdb.db', echo =True )
if 10:
import os
try:
r = os.system( 'dropdb testdb')
r = os.system( 'createdb testdb')
except OSError: pass
db_postgres = create_engine( 'postgres:///testdb', echo =True )
SA_VERSION = '0.4'
def checkWith( db):
if SA_VERSION == '0.3':
meta = BoundMetaData( db)
meta.engine.echo = 1
table_Manager = Table( 'Manager', meta,
Column( 'duties', type= String, ),
Column( 'name', type= String, ),
Column( 'id', Integer, primary_key= True, ),
)
else:
meta = MetaData( db)
meta.bind = db
meta.bind.echo = 1
table_Manager = Table( 'Manager', meta,
Column( 'duties', type_= String, ),
Column( 'name', type_= String, ),
Column( 'id', Integer, primary_key= True, ),
)
meta.create_all()
con = db.connect()
isql = table_Manager.insert().compile()
r2 = con.execute( isql, [
dict( name= 'torencho', duties= 'bany'),
dict( name= 'mnogoVojdMalkoIndianec', duties= 'lany'),
])
r2 = r2.last_inserted_ids()
print 'R2: %(r2)s\n' % locals()
#checkWith( db_sqlite)
checkWith( db_postgres)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---