Re: [sqlalchemy] How to use Query.get() with composite primary key

2016-10-23 Thread Mike Bayer
On 10/23/2016 03:46 PM, Ergo wrote: Hi, I'm trying to use get() with composite primary key like this: class GroupPermissionService(BaseService): @classmethod def get(cls, group_id, perm_name, db_session=None): db_session = get_db_session(db_session) return

[sqlalchemy] How to use Query.get() with composite primary key

2016-10-23 Thread Ergo
Hi, I'm trying to use get() with composite primary key like this: class GroupPermissionService(BaseService): @classmethod def get(cls, group_id, perm_name, db_session=None): db_session = get_db_session(db_session) return db_session.query(cls.model).get([group_id,

Re: [sqlalchemy] Re: Relationship between objects in different schemas

2016-10-23 Thread Mike Bayer
On 10/23/2016 10:20 AM, Mike Bayer wrote: On 10/23/2016 06:56 AM, Nikola Radovanovic wrote: Hi, thank you for the quick reply; I will check this solution. As for number of clients - clients are actually companies, so number can be maybe few dozens, or hundred - does this change anything?

Re: [sqlalchemy] BakedQuery with function parameters

2016-10-23 Thread Mike Bayer
On 10/23/2016 06:02 AM, Anton Baranenko wrote: Hi all, based on the successful progress with my previous topic "Using BakedQuery with joined subqueries" (thanks again Mike!) I have the next question. For some of my queries conditions logic is generated based on certain parameters. For

Re: [sqlalchemy] Re: Relationship between objects in different schemas

2016-10-23 Thread Mike Bayer
On 10/23/2016 06:56 AM, Nikola Radovanovic wrote: Hi, thank you for the quick reply; I will check this solution. As for number of clients - clients are actually companies, so number can be maybe few dozens, or hundred - does this change anything? one thing to note is I just checked that

[sqlalchemy] Re: Relationship between objects in different schemas

2016-10-23 Thread Nikola Radovanovic
Hi, thank you for the quick reply; I will check this solution. As for number of clients - clients are actually companies, so number can be maybe few dozens, or hundred - does this change anything? Thanks in advance On Saturday, October 22, 2016 at 2:08:33 PM UTC+2, Nikola Radovanovic wrote: >

[sqlalchemy] BakedQuery with function parameters

2016-10-23 Thread Anton Baranenko
Hi all, based on the successful progress with my previous topic "Using BakedQuery with joined subqueries" (thanks again Mike!) I have the next question. For some of my queries conditions logic is generated based on certain parameters. For example, I have a JSONB field that contains custom

[sqlalchemy] Re: Using BakedQuery with joined subqueries

2016-10-23 Thread Anton Baranenko
Thank you Mike, worked as expected! > -- 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.