Subject | sql replace params |
---|---|
Author | |
Post date | 2018-04-15T01:03Z |
Hi,
I have the next sql command
sql = 'SELECT
"EXPRESSIONS_COMPANY"."ID",
"EXPRESSIONS_COMPANY"."NAME",
"EXPRESSIONS_COMPANY"."NUM_EMPLOYEES",
"EXPRESSIONS_COMPANY"."NUM_CHAIRS",
"EXPRESSIONS_COMPANY"."CEO_ID",
"EXPRESSIONS_COMPANY"."POINT_OF_CONTACT_ID",
? AS "FOO"
FROM "EXPRESSIONS_COMPANY"
WHERE ? = ?
ORDER BY "EXPRESSIONS_COMPANY"."NAME" ASC'
Running this sql
cur.execute(sql, ['value', 'value', 'value'])
Raise an exception:
SQL error code = -804 - Data type unknown'
Of course, fdb doesn't replace params from entire sql command, just from where clause.
Is this behavior the standard according to python db-api ?
Is there another approach to accomplish using fdb without make a string replacement ?
Regards
Maxi
I have the next sql command
sql = 'SELECT
"EXPRESSIONS_COMPANY"."ID",
"EXPRESSIONS_COMPANY"."NAME",
"EXPRESSIONS_COMPANY"."NUM_EMPLOYEES",
"EXPRESSIONS_COMPANY"."NUM_CHAIRS",
"EXPRESSIONS_COMPANY"."CEO_ID",
"EXPRESSIONS_COMPANY"."POINT_OF_CONTACT_ID",
? AS "FOO"
FROM "EXPRESSIONS_COMPANY"
WHERE ? = ?
ORDER BY "EXPRESSIONS_COMPANY"."NAME" ASC'
Running this sql
cur.execute(sql, ['value', 'value', 'value'])
Raise an exception:
SQL error code = -804 - Data type unknown'
Of course, fdb doesn't replace params from entire sql command, just from where clause.
Is this behavior the standard according to python db-api ?
Is there another approach to accomplish using fdb without make a string replacement ?
Regards
Maxi