0

I'm using SQLAlchemy 0.5.8, and seeing this error:

ProgrammingError: (ProgrammingError) can't adapt 'INSERT INTO enumeration_value (id,
key_id, code, name, notes) VALUES (%(id)s, %(key_id)s, %(code)s, %(name)s, %(notes)s)' 
{'key_id': 'aac6fc29-4ccd-4fe4-9118-cfbbd04449fe', 'notes': '', 'code': (u'Barnet',), 
'id': 'd0540c97-882e-4a5b-bf14-b3ebcfeea051', 'name': (u'Barnet',)}

But a direct SQL insert with the values from the error seems to work just fine:

=> INSERT INTO enumeration_value (id, key_id, code, name, notes) 
VALUES ('d0540c97-882e-4a5b-bf14-b3ebcfeea051', 'aac6fc29-4ccd-4fe4-9118-cfbbd04449fe', 
'Barnet', 'Barnet', '');
INSERT 0 1

If the direct SQL works OK, how can I start to debug this?

Incidentally, the line that's throwing the error doesn't seem to have an INSERT statement in it at all, so I am a bit confused:

  File "----barnet.py", line 117, in load_file
    instance = model.Session.query(model.EnumerationValue).filter_by(key=key_barnet_level_2, code=level_2).all()

Do SQLAlchemy filter statements generate INSERT commands, or does this just happen to be the last line before things start to go wrong?

1 Answer 1

0

Figured it out - the problem was actually a syntax error a few lines higher up, with a rogue comma:

key_from = code,

Sorry if I wasted anyone's time. Please close the question.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.