Doh, I should have turned on the SQL echo.  Now that I have, it's even
more puzzling to me.  It shows the 'contact' being inserted and
committed -- but it never appears in MySQL!

 2006-12-23 17:33:15,140 INFO sqlalchemy.engine.base.Engine.0x..cc BEGIN
 2006-12-23 17:33:15,145 INFO sqlalchemy.engine.base.Engine.0x..cc SELECT 
current_timestamp
 2006-12-23 17:33:15,145 INFO sqlalchemy.engine.base.Engine.0x..cc []
 2006-12-23 17:33:15,150 INFO sqlalchemy.engine.base.Engine.0x..cc INSERT INTO 
contact (client_id, email, password, firstname, lastname, ts_created, 
ts_updated) VALUES (%s, %s, %s, %s, %s, %s, %s)
 2006-12-23 17:33:15,150 INFO sqlalchemy.engine.base.Engine.0x..cc [9L, '[EMAIL 
PROTECTED]', None, None, None, datetime.datetime(2006, 12, 23, 17, 33, 44), 
None]
 2006-12-23 17:33:15,158 INFO sqlalchemy.engine.base.Engine.0x..cc COMMIT

 #vendor.upload Query contacts after  flush=[]


If I switch my Pylons development.ini to use an SQLite DB, the app
works as expected until I get to the same flush():

   contact = model.Contact(client_id=client.client_id,
                           email=row['contactemail'],
                           password=row.get('contactpassword'),
                           firstname=row.get('contactfirstname'),
                           lastname=row.get('contactlastname'))
   self.session.save(contact)
   self.session.flush()

The Pylons traceback reports:

   >>  self.session.flush()
   ...
sqlalchemy.exceptions.SQLError: (OperationalError) SQL logic error or missing database 'INSERT INTO contact (client_id, email, password, firstname, lastname, ts_created, ts_updated) VALUES (?, ?, ?, ?, ?, ?, ?)' [1, '[EMAIL PROTECTED]', None, None, None, '2006-12-24 00:25:35', None]
The SQL echo looks good, until the ROLLBACK:

   2006-12-23 19:25:35,874 INFO sqlalchemy.engine.base.Engine.0x..0c BEGIN
   2006-12-23 19:25:35,878 INFO sqlalchemy.engine.base.Engine.0x..0c SELECT 
current_timestamp
   2006-12-23 19:25:35,878 INFO sqlalchemy.engine.base.Engine.0x..0c []
   2006-12-23 19:25:35,879 INFO sqlalchemy.engine.base.Engine.0x..0c INSERT 
INTO contact (client_id, email, password, firstname, lastname, ts_created, 
ts_updated) VALUES (?, ?, ?, ?, ?, ?, ?)
   2006-12-23 19:25:36,031 INFO sqlalchemy.engine.base.Engine.0x..0c [1, 
'[EMAIL PROTECTED]', None, None, None, '2006-12-24 00:25:35', None]
   2006-12-23 19:25:36,086 INFO sqlalchemy.engine.base.Engine.0x..0c ROLLBACK

That self.session is created with a Pylons __before__ method:

   def __before__(self):
       self.session = session_context.current
       self.q = self.session.query(model.Vendor)

and other methods use this just fine as far as I can tell.
How can I track down whether there's a "missing database" or what the
"SQL logic error" might be?
Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to