[sqlalchemy] How to create a Partitioned Oracle Table in SQLAlchemy?

2017-03-22 Thread Matthew Moisen
Hello, In Oracle we can create a Partitioned Table like the following: CREATE TABLE sales_hash (s_productid NUMBER, s_saledate DATE, s_custid NUMBER, s_totalprice NUMBER) PARTITION BY HASH(s_productid) ( PARTITION p1 TABLESPACE tbs1 , PARTITION p2 TABLESPACE tbs2 , PARTITION p3

Re: [sqlalchemy] is it possible to create an ORM session with a db cursor?

2017-03-22 Thread mike bayer
you'd need to patch some kind of fake DBAPI connection that returns this cursor from the cursor() method. it would be ugly but if the cursor behaves well it could work. you'd get session.connection() to get a sqlalchemy.engine.Connection, then patch your "fake" DBAPI connection into it as

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-03-22 Thread mike bayer
On 03/22/2017 02:17 PM, da...@benchling.com wrote: Hey all, We were wondering if you had any advice on having a large (~10) number of polymorphic subclasses for a single base class. Using with_polymorphic: '*' causes SQLAlchemy to joinedload all subclasses like this: SELECT ... FROM

Re: [sqlalchemy] Performing filter by using string

2017-03-22 Thread mike bayer
keeping in mind it's absolutely not safe to do this with *untrusted* user input, you'd use exec/eval: globals_ = globals() locals_ = {} exec("%s = map_model" % model, globals_, locals_) q = session.query(model).filter(eval(condition, globals_, locals_)) On 03/22/2017 10:00 AM, Vijaya Sekar

[sqlalchemy] is it possible to create an ORM session with a db cursor?

2017-03-22 Thread Jonathan Vanasco
longshot, i know. We've got some legacy twisted code that does raw operations via a twisted.enterprise.adbapi connection pool with the psycopg2 driver. Other services in this deployment are configured to use SqlAlchemy for all operations - this is the legacy holdout. There are a few chunks

[sqlalchemy] Large number of polymorphic subclasses

2017-03-22 Thread damon
Hey all, We were wondering if you had any advice on having a large (~10) number of polymorphic subclasses for a single base class. Using with_polymorphic: '*' causes SQLAlchemy to joinedload all subclasses like this: SELECT ... FROM base_table LEFT OUTER JOIN sub_table_1 ON base_table.id =

[sqlalchemy] Performing filter by using string

2017-03-22 Thread Vijaya Sekar
Hi everyone, I have an string which has the condition to be performed while retrieving from database. I automap my model and make reference to it by using another variable name. How can achieve retrieve data by filter which is in string? here is my code from sqlalchemy import create_engine