Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-08 Thread Tucker Beck
Thanks so much! I ended up doing the compilation with the postgresql.dialect() instead of the engine in our source code because of import ordering, but it worked like a charm! On Wed, Nov 8, 2017 at 3:21 PM, Mike Bayer wrote: > On Wed, Nov 8, 2017 at 6:17 PM, Tucker Beck wrote: > > Using the ca

Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-08 Thread Mike Bayer
On Wed, Nov 8, 2017 at 6:17 PM, Tucker Beck wrote: > Using the cast worked great. However, now when I want to print the query > statement I get an error > > code: > from sqlalchemy import Column, Integer, Text, ARRAY, cast, create_engine > from sqlalchemy.orm import Session > from sqlalchemy.ext.d

Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-08 Thread Tucker Beck
Using the cast worked great. However, now when I want to print the query statement I get an error code: from sqlalchemy import Column, Integer, Text, ARRAY, cast, create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.post

Re: [sqlalchemy] More complete support for Views

2017-11-08 Thread Mike Bayer
On Wed, Nov 8, 2017 at 1:57 PM, wrote: > So I'm trying to add support for Views, following a few recipes like this, > and this. > > Beyond the DDL element, I'd like greater integration with higher level > SQLAlchemy abstractions. > > For example, using the first recipe, the view isn't registered

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Mike Bayer
On Wed, Nov 8, 2017 at 1:58 PM, Sven wrote: > What do you mean by "deduplication" ? it means if you have a collection : [a, b] and you try to add "a" again: collection.append(a) you get: [a, b] that is, "append" is idempotent given a particular object identity. > > I have certainly just

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Sven
What do you mean by "deduplication" ? I have certainly just a few exotic different type of collection. The others are standard (lists, dictionaries, ordereddict, etc), but I don't understand why you are asking that :p Are you asking that because you think that the solution would be to always u

[sqlalchemy] More complete support for Views

2017-11-08 Thread charles
So I'm trying to add support for Views, following a few recipes like this , and this . Beyond the DDL element, I'd like great

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Mike Bayer
On Nov 8, 2017 1:09 PM, "Sven" wrote: Thank you for your answer. It is always very complete and interesting. *"so the super-duper best way to fix for the above use case, if * *possible, would be to use collection_class=set rather than list. * *sets are all around better for relationship() and if

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Sven
Thank you for your answer. It is always very complete and interesting. *"so the super-duper best way to fix for the above use case, if * *possible, would be to use collection_class=set rather than list. * *sets are all around better for relationship() and if I was writing * *SQLAlchemy today this

Re: [sqlalchemy] Help needed troubleshooting error on session commit after deletion

2017-11-08 Thread Mike Bayer
On Wed, Nov 8, 2017 at 7:43 AM, Hugo Heyman wrote: > Hi again, > > I've been trying to isolate the problem and I think I have found what's > causing this for me. A while back I added this package > https://github.com/operator/sqlalchemy_bulk_lazy_loader > (it simplified things when using graphene-

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Mike Bayer
On Wed, Nov 8, 2017 at 5:05 AM, Sven wrote: > Hello, > > I am actually working on my previous post about the OrderedDict and the None > values and I met new problems and new questions. I didn't found answers on > the Internet, so here I am ! > > As explained in the official documentation (or in th

Re: [sqlalchemy] Help needed troubleshooting error on session commit after deletion

2017-11-08 Thread Hugo Heyman
Hi again, I've been trying to isolate the problem and I think I have found what's causing this for me. A while back I added this package https://github.com/operator/sqlalchemy_bulk_lazy_loader (it simplified things when using graphene-sqlalchemy) The error seem to happen even without using the cu

[sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Sven
Hello, I am actually working on my previous post about the OrderedDict and the None values and I met new problems and new questions. I didn't found answers on the Internet, so here I am ! As explained in the official documentation (or in the following topic : https://groups.google.com/forum/#!