my Firebird database has some Sequence values defined as

CREATE SEQUENCE S_org;

with an appropriate trigger to set a value.

RECREATE TRIGGER TBI_org FOR org
 ACTIVE BEFORE INSERT POSITION 0
 AS BEGIN
    IF (NEW.Id IS NULL) THEN
      NEW.Id = NEXT VALUE FOR S_org;
    END^


Using reflection in sqlalchemy i get an error when trying to store an
entry in the ORG table.

  File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 1392, in flush
    self._flush(objects)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 1473, in _flush
    flush_context.execute()
  File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/
unitofwork.py", line 302, in execute
    rec.execute(self)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/
unitofwork.py", line 446, in execute
    uow
  File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py",
line 1884, in _save_obj
    execute(statement, params)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
line 1191, in execute
    params)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
line 1271, in _execute_clauseelement
    return self.__execute_context(context)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
line 1302, in __execute_context
    context.parameters[0], context=context)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
line 1401, in _cursor_execute
    context)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
line 1394, in _cursor_execute
    context)
  File "/usr/lib/python2.7/site-packages/sqlalchemy/dialects/firebird/
base.py", line 680, in do_execute
    cursor.execute(statement, parameters or [])
InterfaceError: (InterfaceError) (0L, "Error while attempting to
convert object of type <class 'sqlalchemy.schema.Sequence'> to
database-internal numeric type for storage in field [name not known at
this stage of query execution].  The invalid input object is:
Sequence(u's_org', start=1, increment=1, optional=False)") 'INSERT
INTO org (id, name, contact, dept, vatnr, country, city, street,
building, postcode, phone, fax, email) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' (Sequence(u's_org', start=1,
increment=1, optional=False), u'xyz', None, None, None, u'CH', None,
None, None, None, None, None, None)


It appears that Sqlalchemy does not process correctly  the  SEQUENCE
keyword in recent versions of Firebird

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

Reply via email to