[sqlalchemy] too many SQL variables in in_

2014-09-05 Thread mando
Hi to all, I wrote a method like this to reuse the code for many tables at the same time[0] But, with more than 1000 records sqlite doesn't accepts the amount of id inside .in_(id_list) How can I filter, split or can manage it? Thanks a lot and best regards, Luca [0] def

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Alex Grönholm
Thanks. I've filed an issue https://bitbucket.org/zzzeek/sqlalchemy/issue/3185/more-than-one-level-of-abstract-concrete at Bitbucket. A follow-up question: Why are abstract base classes not present in the declarative class registry? Or is there another way to get all the mapped classes

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Michael Bayer
well it's not set to be mapped until after the setup part of it. if you want to get every class whether mapped or not, maybe use Base.__subclasses__() ? What's the use case where you need the abstract base in the decl class registry? it's not really something you'd want to refer to in a

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Alex Grönholm
You're right, I'm dumb. I should've just used __subclasses__ and be done with it. The use case is that I have a client-server app and I build a list of all classes for the client so the client knows which column types to use in tables. It's also used for automatically generating the

[sqlalchemy] Old but Gold - SQLA + Twisted

2014-09-05 Thread Jean Marcel Duvoisin Shmidt
Hi everyone! I have a more complex and architectural question to make, it will be a bit long, but I want to make myself clear as I already have done some research ;D in our company we have some *really* cool stuff made out of SQLA, we wrote over its ORM an abstraction to allow us to build the

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Alex Grönholm
Hm not so dumb actually, because __subclasses__ only lists immediate subclasses. Getting all the mapped classes would involve more work that way. So my preferred method remains this: def get_all_mapped_classes(): return [cls for cls in Base._decl_class_registry.values() if isinstance( cls,

Re: [sqlalchemy] Session.close() appears to infrequently not expunge all objects

2014-09-05 Thread Lonnie Hutchinson
On Thu, Sep 4, 2014 at 5:53 PM, Michael Bayer mike...@zzzcomputing.com wrote: The code I say appears to expect the session_id to remain on detached states in certain situations is that the check in Session._attach checks not only the session_id but that the referenced session still exists in

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Michael Bayer
I usually traverse recursively through __subclasses__(). On Sep 5, 2014, at 10:49 AM, Alex Grönholm alex.gronh...@nextday.fi wrote: Hm not so dumb actually, because __subclasses__ only lists immediate subclasses. Getting all the mapped classes would involve more work that way. So my

Re: [sqlalchemy] Session.close() appears to infrequently not expunge all objects

2014-09-05 Thread Michael Bayer
On Sep 5, 2014, at 12:03 PM, Lonnie Hutchinson lonn...@skytap.com wrote: On Thu, Sep 4, 2014 at 5:53 PM, Michael Bayermike...@zzzcomputing.com wrote: The code I say appears to expect the session_id to remain on detached states in certain situations is that the check in

Re: [sqlalchemy] too many SQL variables in in_

2014-09-05 Thread Michael Bayer
you batch out the values to be used in the IN, then one of two choices: my preference is to run separate SELECT statements, using IN with each batch. If you really can't do that, you can combine the batches of IN groups with an OR: x IN (batch1) OR x IN (batch2) ... keep in mind when you

Re: [sqlalchemy] Session.close() appears to infrequently not expunge all objects

2014-09-05 Thread Lonnie Hutchinson
Here is the basic outline of the web request hander. It creates an operation, gets the return value, and either spawns a thread to execute the operation (with non-sqlalchemy related instrumentation) or completes the execution on the operation model. In the case I see there is a provisioning phase

[sqlalchemy] Bulk update when using .execute() with multiple parameters?

2014-09-05 Thread Joshua Ma
Hi all, Can someone confirm for me that, when Connection.execute is run with an UPDATE statement and a list of 100k values, you get a batch update query that incurs only one DB round-trip instead of 100k roundtrips? And this should be true for alembic's execute

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Alex Grönholm
Sorry to be asking more questions, but the docs on inheritance don't get into much details on how the properties are supposed to work. The following code produces unexpected results: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import

[sqlalchemy] Re: Bulk update when using .execute() with multiple parameters?

2014-09-05 Thread Lloyd Kvam
You really want to test this yourself on YOUR setup. I know my code is sending a single execute for this scenario, but I'm not hitting any speed bumps. Set echo to True and see what happens. (a_table.metadata.bind.echo = True). Then set it back to False. You can change echo on the fly.

Re: [sqlalchemy] More than one level of abstract base classes doesn't work

2014-09-05 Thread Michael Bayer
the Document class starts out as unmapped. then when you call prepare() (or whatever it's called for ACB), it calls the polymorphic_union() function and them maps Document to that. This union has just columns in it, e.g. _name in this case. There's no attempt to reconcile column labels used