[sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-11-30 Thread amit geron
As I already mentioned, I tried your suggestion but with no success. The names are unique anyway, and I don't understand the how it's related to my question.. Could you please provide a working example that will demonstrate how 2 objects inherit from the same class, and hold the same primary

[sqlalchemy] passing a dictionary to a Base derived constructor?

2015-11-30 Thread Matt Zagrabelny
Greetings, I've googled a bit, checked the sqlalchemy group archives, and looked at the API for resolution to the following question, but came up short on a definitive answer. I've got a table with a number of fields. It is defined as such: from sqlalchemy.ext.declarative import

[sqlalchemy] Re: passing a dictionary to a Base derived constructor?

2015-11-30 Thread mzagrabe
On Monday, November 30, 2015 at 11:25:37 AM UTC-6, Matt Zagrabelny wrote: > > Greetings, > > I've googled a bit, checked the sqlalchemy group archives, and looked > at the API for resolution to the following question, but came up short > on a definitive answer. > > I've got a table with a

[sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-11-30 Thread Jonathan Vanasco
You should ask on the flask/flask-sqlalcemy support channel. They'll be better able to help. According to the docs : ~ Where can I get help? Join us on the #pocoo IRC channel on irc.freenode.net. According to their API docs and examples, setting __tablename__ (standard sqlalchemy

Re: [sqlalchemy] new object using a dictionary as the parameter

2015-11-30 Thread mzagrabe
On Monday, November 23, 2015 at 3:02:35 PM UTC-6, Simon King wrote: > > > > On 23 Nov 2015, at 17:58, mzag...@d.umn.edu wrote: > > > > Greetings, > > > > I'm new to SQLAlchemy - sorry if the answer to this question is obvious. > > > > I have a table with many fields. > > > > I've

Re: [sqlalchemy] Re: memory of query cache not release when session close

2015-11-30 Thread Mike Bayer
On 11/30/2015 06:02 AM, Hongxin Song wrote: > > Although the all rows are paged into memory, they are cached by > identity map for query with loading once。 > Then the total size of memory dose not reduce. > Is that so? > and how can I clear identity-map or close indentity-map pattern?

[sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-11-30 Thread Jonathan Vanasco
It should still work as a reference because the pacakge you use doesn't override this. The extension's API makes this clear: http://flask-sqlalchemy.pocoo.org/2.1/api/#models _tablename__ The name of the

Re: [sqlalchemy] Re: Pyramid SQLAlchemy tutorial error

2015-11-30 Thread Mike Bayer
On 11/30/2015 09:20 AM, Srikanth Bemineni wrote: > Hi all, > > How do we debug these kind of issues in python ?. The problem was > completely some where else, but error was thrown during database > operation, with no info on the actual issue. it's a dynamic language, so whatever works - we

Re: [sqlalchemy] How to profit from dynamic and eager loading at the same time

2015-11-30 Thread Mike Bayer
On 11/30/2015 07:36 AM, Leily Zafari wrote: > I have two tables "Factorys" and "Products", each "Factory" can have a > large collection of "Products". For appends and filters the dynamic > loading method has been applied. > > | > | > |classFactory(Base): > > __tablename__ ='factorys' >

[sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Alyssa Kwan
Hi, The problem I'm trying to solve is I've created a multi-temporal relational table construct (à la bitemporality) that I want to create SQLAlchemy Core composite operations for (and eventually SQLAlchemy ORM). Let's call these TemporalRelationSet's. I've subclassed SchemaItem. I also do

Re: [sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Mike Bayer
On 11/30/2015 12:54 PM, Alyssa Kwan wrote: > Hi, > > The problem I'm trying to solve is I've created a multi-temporal > relational table construct (à la bitemporality) that I want to create > SQLAlchemy Core composite operations for (and eventually SQLAlchemy ORM). > > Let's call these

Re: [sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Mike Bayer
On 11/30/2015 02:29 PM, Alyssa Kwan wrote: > Thanks Michael, > > These constructs are actually composed of 3 tables - the temporal data > itself, a clock table, and an element clock table - both the clocks keep > track of points in time that exist within time ranges since ranges are > lossy.

Re: [sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Alyssa Kwan
Thanks, Michael! Any thoughts on the autoload? Thanks, Alyssa On Monday, November 30, 2015 at 11:43:30 AM UTC-8, Michael Bayer wrote: > > > > On 11/30/2015 02:29 PM, Alyssa Kwan wrote: > > Thanks Michael, > > > > These constructs are actually composed of 3 tables - the temporal data > >

Re: [sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Alyssa Kwan
Thanks Michael, These constructs are actually composed of 3 tables - the temporal data itself, a clock table, and an element clock table - both the clocks keep track of points in time that exist within time ranges since ranges are lossy. Does this advice still hold? A related requirement is

Re: [sqlalchemy] How to get id from newly inserted row

2015-11-30 Thread Sami Pietilä
Thank you! This kind of approach seems to work well: ins = records.insert().returning(records.c.id) result = connection.execute(ins) row = result.fetchone() sunnuntai 29. marraskuuta 2015 18.53.48 UTC+2 Michael Bayer kirjoitti: > > > > On 11/29/2015 10:50 AM, Sami Pietilä wrote: > > Hi, > >

Re: [sqlalchemy] Subclassing MetaData to Support Higher Level Table-Containing Construct

2015-11-30 Thread Mike Bayer
On 11/30/2015 02:51 PM, Alyssa Kwan wrote: > Thanks, Michael! > > Any thoughts on the autoload? I'd assume you'd want to use a naming convention. e.g. my_autoload('mything') looks for tables 'mything_temporal', 'mything_clock', 'mything_element_clock', something like that. > > Thanks, >

Re: [sqlalchemy] Re: Quick way to deep copy an object?

2015-11-30 Thread Jonathan Vanasco
Look into `cascade` Here's a related thread https://groups.google.com/forum/#!searchin/sqlalchemy/cascade|sort:date/sqlalchemy/eIOkkXwJ-Ms/JLnpI2wJAAAJ -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop

Re: [sqlalchemy] Re: Quick way to deep copy an object?

2015-11-30 Thread Mark Sternig
I am in need of doing something similar (a deep copy of related objects). Has anyone embarked on this adventure yet and mind sharing any tips, code, etc? My use case is to copy a retail Order, and all OrderLineItems, OrderNotes, OrderStatus, etc. Thank you in advance for any help. On

[sqlalchemy] postgresql, jsob and like operator

2015-11-30 Thread Michal Nowikowski
Hello, I'm using Postgresql and JSONB column. I would like to write a query using ORM that will generate such SQL query: SELECT id,name,details FROM Device WHERE details::text LIKE '%99%'; where details is of JSONB type and it is converted to text and then like operator is used. Generally

Re: [sqlalchemy] Re: memory of query cache not release when session close

2015-11-30 Thread Hongxin Song
Although the all rows are paged into memory, they are cached by identity map for query with loading once。 Then the total size of memory dose not reduce. Is that so? and how can I clear identity-map or close indentity-map pattern? Thanks for your help! 在 2015年11月28日星期六

[sqlalchemy] Re: Pyramid SQLAlchemy tutorial error

2015-11-30 Thread Srikanth Bemineni
Hi All, I think I was able to figure out the issue. Before -> DBSession = scoped_session (sessionmaker(extension=ZopeTransactionExtension)) After -> DBSession = scoped_session (sessionmaker(extension=ZopeTransactionExtension())) If I am correct, I was passing class instead of an instance.

[sqlalchemy] How to profit from dynamic and eager loading at the same time

2015-11-30 Thread Leily Zafari
I have two tables "Factorys" and "Products", each "Factory" can have a large collection of "Products". For appends and filters the dynamic loading method has been applied. class Factory(Base): __tablename__ = 'factorys' ID = Column(Integer, primary_key=True) products =

[sqlalchemy] Re: Pyramid SQLAlchemy tutorial error

2015-11-30 Thread Srikanth Bemineni
Hi all, How do we debug these kind of issues in python ?. The problem was completely some where else, but error was thrown during database operation, with no info on the actual issue. Srikanth On Sunday, November 29, 2015 at 8:13:45 PM UTC-6, Srikanth Bemineni wrote: > > Hi, > > I am going