Hello. I am receiving the error:
sqlalchemy.exceptions.SQLError: (ProgrammingError) can't adapt 'INSERT
INTO workorderlines (workorderlines_rowid) VALUES (%
(workorderlines_rowid)s)' {'workorderlines_rowid':
Sequence('workorderlines_rowid_seq',start=None,increment=None,optional=False)}
running the following simplified version of what I am working with:
from sqlalchemy import *
db = create_engine('postgres://[EMAIL PROTECTED]:5432/fleettest')
db.echo = True
metadata = BoundMetaData(db)
workorderlines_table = Table('workorderlines', metadata,
Column('workorderlines_rowid', Numeric(10,0),
default=Sequence('workorderlines_rowid_seq')),
PrimaryKeyConstraint('workorderlines_rowid'),
)
class Workorder_Line(object):
def __repr__(self):
return "Workorder_Line: %d %d %d %d%s" % (
self.company, self.store, self.workorder, self.line,
self.suffix)
mapper(Workorder_Line, workorderlines_table)
def main():
session = create_session()
obj = Workorder_Line()
session.save(obj)
session.flush()
if __name__ == '__main__': main()
Primarily, I have a postgres database with a sequence setup as a
default on the workorderlines_rowid column within the database. If I
try to write out a record without setting the workorderlines_rowid
value or without specifying a default, the SQL tries to insert it with
a NULL value. Since I couldn't figure out how to disable that, I have
tried linking a sqlalchemy default by either explicity specifying the
database sequence as above, or by using PassiveDefault to specify
"DEFAULT", but in either case, I get the above error. Is there a way
to stop sqlalchemy from trying to insert a value for a column I
haven't specified a value for? Is something wrong with my sequence
specification?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---