Re: [sqlalchemy] 'selectin' loading with composite keys on DB2 for i

2019-06-27 Thread Steven James
This Worked! @compiles(BinaryExpression, 'ibm_db_sa') def _comp_binary(element, compiler, **kwargs): text = compiler.visit_binary(element, **kwargs) if element.operator is operators.in_op: text = re.sub(r"\) IN \(", ") IN (VALUES ", text) return text Had to make a couple of chang

Re: [sqlalchemy] 'selectin' loading with composite keys on DB2 for i

2019-06-27 Thread Mike Bayer
On Thu, Jun 27, 2019, at 2:11 PM, Steven James wrote: > Currently, `selectin` loading with composite keys works for me on MySQL and > SQLite. The documentation states that it also works with Postgres. I'm > currently trying to get it working on DB2 (connecting to a DB2 for i, 7.2 > system. >

[sqlalchemy] Re: 'selectin' loading with composite keys on DB2 for i

2019-06-27 Thread Steven James
Sorry... made a typo there... the desired syntax is: `SELECT * FROM table WHERE (table.a, table.b) IN (VALUES (?, ?), (?,?))` On Thursday, 27 June 2019 14:11:16 UTC-4, Steven James wrote: > > Currently, `selectin` loading with composite keys works for me on MySQL > and SQLite. The documentation

[sqlalchemy] 'selectin' loading with composite keys on DB2 for i

2019-06-27 Thread Steven James
Currently, `selectin` loading with composite keys works for me on MySQL and SQLite. The documentation states that it also works with Postgres. I'm currently trying to get it working on DB2 (connecting to a DB2 for i, 7.2 system. (the following assumes a table with the primary key consisting of

Re: [sqlalchemy] How to have MySQL store TIMESTAMP but return timezone-aware datetime objects

2019-06-27 Thread Mike Bayer
On Thu, Jun 27, 2019, at 12:02 PM, Charles-Axel Dein wrote: > Hi, > > I'm trying to have a deleted_at column on my records. I use MySQL and latest > sqlalchemy as of writing. For historical reasons, I want to keep using the > MySQL's TIMESTAMP columns. > > I would like to use timezone-aware d

Re: [sqlalchemy] How to inspect filters

2019-06-27 Thread Andrew Martin
Oh that's really interesting. Thank you for that. I'll definitely tuck that away in my back pocket. My background is really heavy in raw SQL, and meta-programming raw SQL is *awful.* Debugging sql that writes sql and execs it is not fun. I'm not allowed to use sqlalchemy at work because no one else

Re: [sqlalchemy] How to inspect filters

2019-06-27 Thread Jonathan Vanasco
On Wednesday, June 26, 2019 at 2:43:44 PM UTC-4, Andrew Martin wrote: > > That's very interesting, Jonathan. Could you show me a quick example of > that approach? I'm not sure I *need* to do that, but I think I would learn > about SQLAlchemy from such an example and trying to understand it. >

[sqlalchemy] How to have MySQL store TIMESTAMP but return timezone-aware datetime objects

2019-06-27 Thread Charles-Axel Dein
Hi, I'm trying to have a deleted_at column on my records. I use MySQL and latest sqlalchemy as of writing. For historical reasons, I want to keep using the MySQL's TIMESTAMP columns. I would like to use timezone-aware datetime throughout my codebase. Everything in my DB is stored as UTC, so I

Re: [sqlalchemy] Re: Limiting Relationship Depths

2019-06-27 Thread Jonathan Vanasco
On Wednesday, June 26, 2019 at 4:01:31 PM UTC-4, Michael P. McDonnell wrote: > > Awesome, thank you Jonathan. > > I know I've read that at least 3-4 times, but I think I've been staring at > the screen too much these days to actually read. I'll give it a go and let > you know how it goes! >

Re: [sqlalchemy] Where clause when using polymorphic_identity on base class

2019-06-27 Thread Dmytro Starosud
I see, thank you, Mike. So, looks like I just wanted strange thing: having class to be distinct from itself. Thank you for clarifying! Dmytro вт, 25 черв. 2019 о 19:26 Mike Bayer пише: > > > On Fri, Jun 21, 2019, at 7:22 AM, Dmytro Starosud wrote: > > Base class A1 contains polymorphic_identit