ForeignKey gets error with column names that contain "
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
Maybe this is PostgreSQL specific problem. Postgres needs table/column names to be quoted by "" when the name is non-ASCII or when you need to preserve cases.
With such tables/columns SQLObject failes to create constraint because the constraint naming rule simply appends '_exists' after the names.
Say I have a ForeignKey constraint like this;
class Order(SQLObject):
class sqlmeta:
table = '"Order"'
...
store = ForeignKey('Store', dbName='"StoreID"')
This definition generates a wrong SQL like this;
ALTER TABLE "Order" ADD CONSTRAINT "StoreID"_exists FOREIGN ...
It's a simple problem that _exists need to be inside of the quote if original name is quoted by "".