Jorge Vidinha
Jorge Vidinha

Reputation: 434

Python Dataset module error: You might need to add explicit type casts

Having some difficulties to query data from a postgres db using python dataset module , my data is type varchar when i query the data i receive the following error.

ERROR:

LINE 1: ...t * from sources.product where post = 31055183...

HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. [SQL: 'select * from sources.product where post = 310551835']

snip of code used:

deltas = db.query('select * from deltas.deltas_del')

for idx in deltas:
            print type(idx['post'])
            prod = db.query('select * from sources.product where post = 310551835')

Upvotes: 0

Views: 1698

Answers (1)

Joe Young
Joe Young

Reputation: 5895

Add quotes to the value in the right hand side of the where clause since you're filtering by a varchar.

prod = db.query("select * from sources.product where post = '310551835'"

Upvotes: 1

Related Questions