On 03/07/2017 03:49 PM, Jonathan Vanasco wrote:
I'm deploying something and unsure of the underlying postgresql version
for a given environment.  most deployments are 9.6, a handful are 9.2.
 upgrading everything is not an option I have.

i'm using declarative.

the only issue I have right now, is that JSONB is preferred to JSON
support.  Is there anything within SqlAlchemy that can be done to
determine if the column/operations are JSON vs JSONB?


the dialect has .server_version_info

engine.dialect.server_version_info >= (9, 6)

but you need your engine and connection to handle that. JSONB and JSON have different operator support. So you might want to do a TypeDecorator around it or similar but you can only support a subset of operations (contained by, contains, has_any, etc. aren't on JSON).



I could handle this with some environment variables, but if there is an
option within postgres, I'd like to explore it.

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and
Verifiable Example. See http://stackoverflow.com/help/mcve for a full
description.
---
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to