Re: [sqlalchemy] SQLALchemy 1.0.13: JSONB insert into PostgreSQL fails with internal error 'unsupported jsonb version number 123'

2016-05-31 Thread Andrew M
On Wednesday, June 1, 2016 at 10:39:22 AM UTC+10, Mike Bayer wrote: > have you tried psycopg2? pypostgresql is not a well supported dialect. > That's fixed it - thanks Mike (and thanks for creating SQLAlchemy and Mako). -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] SQLALchemy 1.0.13: JSONB insert into PostgreSQL fails with internal error 'unsupported jsonb version number 123'

2016-05-31 Thread Mike Bayer
have you tried psycopg2? pypostgresql is not a well supported dialect. On 05/31/2016 07:51 PM, Andrew M wrote: Hi, Thanks for SQLAlchemy. I'm trying to insert some JSONB into a PostgreSQL database. My insert succeeds if the column type is JSON but fails if the type is JSONB. SQLAlchemy

[sqlalchemy] SQLALchemy 1.0.13: JSONB insert into PostgreSQL fails with internal error 'unsupported jsonb version number 123'

2016-05-31 Thread Andrew M
Hi, Thanks for SQLAlchemy. I'm trying to insert some JSONB into a PostgreSQL database. My insert succeeds if the column type is JSON but fails if the type is JSONB. SQLAlchemy version: sqlalchemy-1.0.13 PostgreSQL: 9.5.3 DBAPI: py-postgresql Python: 3.4 OS: Windows 8.1 64-bit Here's my test

Re: [sqlalchemy] Re: Dealing with large collections in a scaffolded application

2016-05-31 Thread Horcle
Hi Michael, The backref/backpopulate was my attempt at cleaning this up, and I've obviously made more of a mess of it. (^_^) The patient_id as a FK (versus use of the PK from the patient table) was a deliberate choice for ease of getting the db up. It was indexed in the patient table on the db

Re: [sqlalchemy] Re: Dealing with large collections in a scaffolded application

2016-05-31 Thread Mike Bayer
you should use "dynamic" and your relationships are mis-configured with mis-use of the backref() construct, as you've constructed relationships on both sides that are mutual you'd use back_populates: class Encounter(Model): patient = relationship( "Patient",

[sqlalchemy] Re: Dealing with large collections in a scaffolded application

2016-05-31 Thread Horcle
I guess my question is: How can I efficiently load Patient and its related Encounters? I have tried various loading strategies of dynamic, joined (I would think this would be the desired option), subquery, no load, etc., and it these do not load. On the other hand, I can load Encounter just

Re: [sqlalchemy] Help with a custom "seconds_interval()" construct

2016-05-31 Thread Kent Bower
Thanks Mike. I'm not sure FunctionElement is most appropriate or if Interval() is the best "type," but for future readers, as a recipe, this seems to work: class seconds_interval(FunctionElement): type = Interval() name = 'seconds' def __init__(self, *args, **kwargs):

[sqlalchemy] Dealing with large collections in a scaffolded application

2016-05-31 Thread Horcle
I have the following two models: Class Encounter(Model): __tablename__ = 'cp_service' id = Column(Integer, primary_key=True, autoincrement=True) master_service_id = Column(String(255)) admission_datetime = Column(DateTime) admission_provider_id = Column(String(255))