Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread Srikanth Bemineni
Hi, Sorry some of the debug trace was missing from the previous post WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x15dc190 pid: 10256 (default app) Inside session_shardid ** 2016-11-25 21:34:50,808 INFO [sqlalchemy.engine.base.Engine:1140][b 'uWSGIWorker2Core0'] select

Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread Srikanth Bemineni
Hi, I was not using the DBSession.connection() while creating the tables when invoking the create_all function on the metadata. After fixing that issue I end with an another issue. It looks like the session(scoped_session), where I set the shard id, and the session that I receive, when the

Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread Srikanth Bemineni
Hi, Just trying to integrate the recipe into my pyramid application. Sqlalchemy 1.1.4 How do we put an event on a sessionmaker() managed by scope_session in a pyramid application. This doesn't seem to work. Is the connection already established ? engine = engine_from_config(settings,

Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread mike bayer
On 11/25/2016 03:55 PM, Srikanth Bemineni wrote: Hi Mike, The more "high scale" way here if you're really doing hundreds/thousands of different sets of tables is to modify the SQL statements on the way out. That example is here:

Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread Srikanth Bemineni
Hi Mike, The more "high scale" way here if you're really doing hundreds/thousands > of different sets of tables is to modify the SQL statements on the way > out. That example is here: > > https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/SessionModifiedSQL > . This does exactly the

Re: [sqlalchemy] Set/clear mapping for some tables only

2016-11-25 Thread mike bayer
On 11/24/2016 11:04 PM, Srikanth Bemineni wrote: Hi, I am using sqlalchemy in my pyramid application. I have situation here, where I need to map a table on the fly in the application during run time. I also dont want to re-map all tables, there are some table which are defined using a

[sqlalchemy] Re: Set/clear mapping for some tables only

2016-11-25 Thread Srikanth Bemineni
Hi, Is there way to map a class to a new table again mapper(klass, table_1) mapping the same klass again mapper(klass, table_2) already has a primary mapper defined. Use non_primary=True to create a non primary Mapper. clear_mappers() will remove *all* current mappers from