What is the sqlalchemy equivalent column type for 'money' and 'OID' in Postgres?
-
21-08-2019 - |
Question
What is the sqlalchemy equivalent column type for 'money' and 'OID' column types in Postgres?
Solution
we've never had an "OID" type specifically, though we've supported the concept of an implicit "OID" column on every table through the 0.4 series, primarily for the benefit of postgres. However since user-table defined OID columns are deprecated in Postgres, and we in fact never really used the OID feature that was present, we've removed this feature from the library.
If a particular type is not supplied in SQLA, as an alternative to specifying a custom type, you can always use the NullType which just means SQLA doesn't know anything in particular about that type. If psycopg2 sends/receives a useful Python type for the column already, there's not really any need for a SQLA type object, save for issuing CREATE TABLE statements.
OTHER TIPS
from the argument on this link The final conclusion was:
Using FLOAT for monetary amounts is an extremely bad idea because of the inexactness of storage and arithmetic .. Using MONEY is discouraged because it is too locale-sensitive NUMERIC should be used instead
This is all I could find: http://docs.sqlalchemy.org/en/rel_0_9/core/types.html
You can make your own type if you want as well.