1

I understand the error but I can't understand where it's coming from.

I have this query which returns a row from the DB:

test = DBSession.query(TTransformerTurnsRatio).filter(TTransformerTurnsRatio.ixSubReport == sub_rep_id).first()

This is what my table looks like: enter image description here

How am I getting a TypeError exception here? I'm lost.

3
  • What does sub_rep_id reference? If it references an int you'll need to cast it into a string str(sub_rep_id) so the types in the equality statement match Commented Aug 18, 2014 at 18:46
  • sub_rep_id is the id of the subreport that I am getting from another table. When I'm debugging it says the id is of type 'int', which works in other queries. I've even tried to cast it to string but even that still gives me the same error Commented Aug 18, 2014 at 18:48
  • Found the problem. In sql server management studio I changed the value type of sTap to int from nvarchar. But in my models file I have sTap still as Unicode. So I believe that caused the error Commented Aug 18, 2014 at 19:13

1 Answer 1

1

In sql server management studio I changed the value type of sTap to int from nvarchar. But in my models file I have sTap still as Unicode.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.