Re: [sqlalchemy] Adding a relationship for specific rows based on foreign value

2017-06-19 Thread mike bayer
On 06/19/2017 08:29 PM, Van Klaveren, Brian N. wrote: Hi, I want to represent a One to Many relationship with an additional default value that depends on a value in the foreign table. I think what I want is something like the following: class UserDatabase(Base): db_id =

[sqlalchemy] Re: ImportError: cannot import name postgresql

2017-06-19 Thread shrey . chauhan
this is the stack trace : [Mon Jun 19 18:11:01.431528 2017] [:error] [pid 18592] [remote 10.11.12.15:128] Traceback (most recent call last): [Mon Jun 19 18:11:01.431548 2017] [:error] [pid 18592] [remote 10.11.12.15:128] File "/var/lib/enclouden-orchestrator/enclouden-orchestrator.wsgi",

[sqlalchemy] Adding a relationship for specific rows based on foreign value

2017-06-19 Thread Van Klaveren, Brian N.
Hi, I want to represent a One to Many relationship with an additional default value that depends on a value in the foreign table. I think what I want is something like the following: class UserDatabase(Base): db_id = Column(Integer, primary_key=True) repo_id = Column(Integer,

[sqlalchemy] Re: Only return single entity from query

2017-06-19 Thread Jonathan Vanasco
You're not joining anything onto the `rProductCategoryHistory` table, so depending on your DB you may be getting populated rows for rProduct that don't match anything. you probably want something like this... query = db.session.query(rProduct)\ .join(rProductHistoricalDetails,

[sqlalchemy] SQLAlchemy 1.1.11 Released

2017-06-19 Thread mike bayer
SQLAlchemy release 1.1.11 is now available. Release 1.1.11 includes a series of fixes providing forwards-compatibility with a variety new behaviors in supported databases. A few other core fixes and one ORM-related fix is also included. Changelog for 1.1.11 is at:

[sqlalchemy] Re: Concise, Pythonic query syntax

2017-06-19 Thread Bryan Jones
Mike, Thanks for your careful analysis and thoughtful comments. I appreciate the time you spent to think about this. I agree that this does represent simpler syntax for a narrow class of common operations. Per your advice, I'll work this up into a package and post it on pypi. Thanks for the

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-19 Thread jens . troeger
Thank you, that worked. Alas, I might have to use an explicit association object after all if I want to set the *is_manager* value in the association table. Simply assigning a new User to the Team.managers

[sqlalchemy] Only return single entity from query

2017-06-19 Thread Ryan Weinstein
query = db.session.query(rProductCategoryHistory,rProduct)\ .join(rProduct,rProduct.r_id==rProductCategoryHistory.r_id)\ .join(rProductHistoricalDetails, rProductHistoricalDetails.id==rProduct.most_recent_historical_details_id)\

[sqlalchemy] ImportError: cannot import name postgresql

2017-06-19 Thread shrey . chauhan
Hi, I am using a remote postgres server: *PostgreSQL 9.6.2sqlalchemy 1.1.10* running my app on Apache webserver, but whe i try hitting any API i get this error- *ImportError:* *cannot import name postgresql* this is the line which is creating issues :-* from sqlalchemy.dialects import

Re: [sqlalchemy] Re: SQLAlchemy JTI subqueryload bug

2017-06-19 Thread mike bayer
thanks! if they're deep "incorrect query" things in the ORM like this, I fix those really fast. Inconvenient things with Core / typing system etc., not so much :) On 06/19/2017 12:12 AM, Sherwin Yu wrote: Mike, thanks for responding and fixing this so quickly

Re: [sqlalchemy] ImportError: cannot import name postgresql

2017-06-19 Thread mike bayer
if more of a stack trace is present in error_log, that would help, also to clarify if this is mod_wsgi, and if daemon mode is present or not. On 06/19/2017 06:48 AM, shrey.chau...@invicto.in wrote: Hi, I am using a remote postgres server: *PostgreSQL 9.6.2 sqlalchemy 1.1.10* running my app

SQLAlchemy 1.1.11 Released

2017-06-19 Thread mike bayer
SQLAlchemy release 1.1.11 is now available. Release 1.1.11 includes a series of fixes providing forwards-compatibility with a variety new behaviors in supported databases. A few other core fixes and one ORM-related fix is also included. Changelog for 1.1.11 is at: