[sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests : @region.cache_on_arguments() def get_my_model(id): return DBSession().query(Model).get(id) I retrieve models : model1 = get_my_model(5) model2 = get_my_model(5) model2 is

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread Simon King
On Tue, Sep 30, 2014 at 8:52 AM, tonthon tontho...@gmail.com wrote: Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests : @region.cache_on_arguments() def get_my_model(id): return DBSession().query(Model).get(id) I retrieve

[sqlalchemy] NVARCHAR doubt

2014-09-30 Thread Mariano Mara
Hi there. I have some code that works ok in PG and now I need to make it work with Oracle, however I am hitting this error with NVARCHAR and I am not sure how to handle it. First a small code in order you can reproduce it (as you can see name has been defined as UnicodeText): from sqlalchemy

[sqlalchemy] Re: NVARCHAR doubt

2014-09-30 Thread Mariano Mara
Sorry, I meant NCLOB, not NVARCHAR. 2014-09-30 16:57 GMT-03:00 Mariano Mara mariano.m...@gmail.com: Hi there. I have some code that works ok in PG and now I need to make it work with Oracle, however I am hitting this error with NVARCHAR and I am not sure how to handle it. First a small code

[sqlalchemy] Re: NVARCHAR doubt

2014-09-30 Thread Mariano Mara
I just noticed that the error code comes from oracle directly and it is not sqlalchemy related. Looks like the best way is not to use an unicodetext field (if I plan to use to to group results). Probably I failed to read such limitation in oracle's doc. Sorry for the inconvenience. 2014-09-30

[sqlalchemy] Define a model as a subset of table data

2014-09-30 Thread katie louise
SQLAlchemy newbie here. I'm trying to define a model (subclassed by another model) that represents a subset of table data of the parent model. Specifically, I want the subclass to map the most recent row for a given ID. For example, suppose I have the following model: class

Re: [sqlalchemy] Define a model as a subset of table data

2014-09-30 Thread Michael Bayer
On Sep 30, 2014, at 4:48 PM, katie louise klavent...@gmail.com wrote: SQLAlchemy newbie here. I'm trying to define a model (subclassed by another model) that represents a subset of table data of the parent model. Specifically, I want the subclass to map the most recent row for a given

[sqlalchemy] Re: Define a model as a subset of table data

2014-09-30 Thread Jonathan Vanasco
Two things that won't answer your question: 1. I've had better luck using Mixins instead of inherited subclasses. The main reason is maintenance -- when you end up looking at AddressHistory in 2 years, you might not remember that MostRecentAddress inherits from it. 2. Your sql doesn't make

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Le mardi 30 septembre 2014 13:28:16 UTC+2, Simon King a écrit : On Tue, Sep 30, 2014 at 8:52 AM, tonthon tont...@gmail.com javascript: wrote: Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests :