Hi,
trying SA with MSSQL Express through unixODBC/pyODBC encountered the
following problem:
Traceback (most recent call last):
File "mssql.py", line 66, in ?
checkWith( db_mssql)
File "mssql.py", line 51, in checkWith
session.flush()
File "/home/stefanb/src/hor/sqlalchemy/orm/session.py", line 302, in
flush
self.uow.flush(self, objects)
File "/home/stefanb/src/hor/sqlalchemy/orm/unitofwork.py", line 210,
in flush
flush_context.execute()
File "/home/stefanb/src/hor/sqlalchemy/orm/unitofwork.py", line 400,
in execute
UOWExecutor().execute(self, head)
File "/home/stefanb/src/hor/sqlalchemy/orm/unitofwork.py", line
1018, in execute
self.execute_save_steps(trans, task)
File "/home/stefanb/src/hor/sqlalchemy/orm/unitofwork.py", line
1032, in execute_save_steps
self.save_objects(trans, task)
File "/home/stefanb/src/hor/sqlalchemy/orm/unitofwork.py", line
1023, in save_objects
task.mapper.save_obj(task.polymorphic_tosave_objects, trans)
File "/home/stefanb/src/hor/sqlalchemy/orm/mapper.py", line 1184, in
save_obj
c = connection.execute(statement, params)
File "/home/stefanb/src/hor/sqlalchemy/engine/base.py", line 520, in
execute
return Connection.executors[c](self, object, *multiparams,
**params)
File "/home/stefanb/src/hor/sqlalchemy/engine/base.py", line 560, in
execute_clauseelement
return self.execute_compiled(elem.compile(dialect=self.dialect,
parameters=param), *multiparams, **params)
File "/home/stefanb/src/hor/sqlalchemy/engine/base.py", line 571, in
execute_compiled
self._execute_raw(context)
File "/home/stefanb/src/hor/sqlalchemy/engine/base.py", line 584, in
_execute_raw
self._execute(context)
File "/home/stefanb/src/hor/sqlalchemy/engine/base.py", line 602, in
_execute
raise exceptions.SQLError(context.statement, context.parameters,
e)
sqlalchemy.exceptions.SQLError: (Error) ('HY000', '[HY000] [Easysoft]
[ODBC-SQL Server Driver][SQL Server]General error: connection is busy
with results of another hstmt (0)') u'INSERT INTO [Manager] (duties,
name) VALUES (?, ?)' ['lany', 'mnogoVojdMalkoIndianec']
Any idea how to avoid this error?
Thanks in advance
Stefan
below is the code reproducing the problem:
###################
from sqlalchemy import *
import os
try:
r = os.system( '''echo -e "drop database proba;\\ncreate database
proba;\\n" | isql probacfg sa
except OSError: pass
import pyodbc
db_mssql = create_engine( 'mssql://sa:[EMAIL PROTECTED]', module= pyodbc)
#'FIX USERNAME/PASSWORD in the above line!!!
def checkWith( db):
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, ),
#Column( 'obj_id', Integer, Sequence('obj_id_seq'), ),
#for mssql only one identity column per table is allowed
)
class Manager( object):
def set( me, **kargs):
for k,v in kargs.iteritems(): setattr( me, k, v)
return me
def __str__(me): return str(me.__class__.__name__)
+':'+str(me.name)
__repr__ = __str__
meta.create_all()
mapper_Manager = mapper( Manager, table_Manager)
import datetime
c = Manager().set( name= 'pencho', duties= 'many')
session = create_session()
session.save(c)
session.flush()
print c
print session.query( Manager).select()
d = Manager().set( name= 'torencho', duties= 'bany')
e = Manager().set( name= 'mnogoVojdMalkoIndianec', duties= 'lany')
session = create_session()
session.save(d)
session.save(e)
session.flush()
checkWith( db_mssql)
########
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---