[sqlalchemy] lazy instrumented attributes and pickle

2009-12-16 Thread avdd
I use pickle to serialise unsaved objects in a user session. Normally this works fine, except that for development I use an auto-reloading server, and pickling some objects is hitting a case where some lazy attribute isn't fully compiled. ... File '/home/avdd/work/careflight/src/intranet.ops2/car

[sqlalchemy] Re: Warning when relation on mapper supercedes the same relation on inherited mapper

2009-12-16 Thread Gunnlaugur Briem
On Dec 16, 4:08 pm, "Michael Bayer" wrote: > - there's two tables, dataset_table and datasetslice_table. > - these two tables have *two* foreign key references to each other - an > inheritance relationship (on unknown columns since they aren't displayed > here) and another on "parent_id" to "id",

Re: [sqlalchemy] Re: performance issues

2009-12-16 Thread Antoine Pitrou
> > I would have to produce anonymized mappings, but I will do so if it's > > What do you mean by "incorrect placement of a flag like > > `remote_side`"? I do have one (exactly one) relation with a > > `remote_side` flag, but the class it is defined on isn't involved in > > the script I have timed

Re: [sqlalchemy] Re: performance issues

2009-12-16 Thread Michael Bayer
Antoine Pitrou wrote: > Hello, > >> just in case you're not motivated to share mappings here, I would note >> that an incorrect placement of a >> flag like "remote_side" on a relation() may be causing this. > > I would have to produce anonymized mappings, but I will do so if it's > useful. What do

[sqlalchemy] Re: performance issues

2009-12-16 Thread Antoine Pitrou
Hello, > just in case you're not motivated to share mappings here, I would note that > an incorrect placement of a > flag like "remote_side" on a relation() may be causing this. I would have to produce anonymized mappings, but I will do so if it's useful. What do you mean by "incorrect placement

Re: [sqlalchemy] Multi-column primary key with autoincrement?

2009-12-16 Thread Adrian von Bidder
Heyho! On Wednesday 16 December 2009 16:36:10 Michael Bayer wrote: > You need to either use the "default" keyword and specify a > function or SQL expression that will generate new identifiers, or just set > up the PK attributes on your new objects before adding them to the > session. ... or just

Re: [sqlalchemy] Re: Type of Column added with column_property

2009-12-16 Thread Michael Bayer
sandro dentella wrote: > Just to be clearer: if I used func.count, the property is correctly > set to Intege type. How can I create a column in the mapper and have > the column reflect the real type in the db. > > I do introspections in columns to prepare the gui to display it and to > add filters

[sqlalchemy] Re: Type of Column added with column_property

2009-12-16 Thread sandro dentella
Just to be clearer: if I used func.count, the property is correctly set to Intege type. How can I create a column in the mapper and have the column reflect the real type in the db. I do introspections in columns to prepare the gui to display it and to add filters on that field (http://sqlkit.argol

[sqlalchemy] Re: Modify the start number of a sequence after it's been created

2009-12-16 Thread Jason R. Coombs
Here's what I do. First, I get the sequence f rom the table's columns seq = table.c.id.default # or if you have a mapper-class # seq = MyClass.id_property.property.columns[0].default Then, I execute that sequence to advance the sequence until it's the value needed. engine.execute(seq) The reas

Re: [sqlalchemy] sqlite and thread

2009-12-16 Thread Michael Bayer
drakkan wrote: > Hi, > connectionstring = 'sqlite:///' + settings.DATABASE_PATH+'? > check_same_thread=False' > > #engine = create_engine(connectionstring, echo=settings.DEBUG, > echo_pool=settings.DEBUG) > engine = create_engine(connectionstring, echo=settings.DEBUG, this line: > pool=NullPool(l

[sqlalchemy] sqlite and thread

2009-12-16 Thread drakkan
Hi, I'm using a sqlite file based database, I'm having problem making database calls from two different thread, the error is the following: SQLite objects created in a thread can only be used in that same thread here is my sa configuration: from sqlalchemy.orm import sessionmaker from sqlalchem

Re: [sqlalchemy] Multi-column primary key with autoincrement?

2009-12-16 Thread Alex Brasetvik
On Dec 16, 2009, at 09:32 , Adrian von Bidder wrote: > sqlite is convenient for development though Except when it *adds* complexity? ;-) -- Alex Brasetvik -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sql

Re: [sqlalchemy] Warning when relation on mapper supercedes the same relation on inherited mapper

2009-12-16 Thread Michael Bayer
Gunnlaugur Briem wrote: > Hi, > > I created a mapper inheriting from another mapper and overriding a > relation definition, and got this warning: > > Warning: relation 'dimensions' on mapper 'Mapper|DataSetSlice| > dataset_slice' supercedes the same relation on inherited mapper > 'Mapper|DataSet|da

Re: [sqlalchemy] Multi-column primary key with autoincrement?

2009-12-16 Thread Michael Bayer
Adrian von Bidder wrote: > Heyho! > > [multi-column primary key where one column is autoincrement int] > > On Wednesday 16 December 2009 05.29:54 Daniel Falk wrote: >> The true problem here >> is with sqlite, which tries to make a "smart" choice about whether to >> autoincrement or not. And it get

[sqlalchemy] Warning when relation on mapper supercedes the same relation on inherited mapper

2009-12-16 Thread Gunnlaugur Briem
Hi, I created a mapper inheriting from another mapper and overriding a relation definition, and got this warning: Warning: relation 'dimensions' on mapper 'Mapper|DataSetSlice| dataset_slice' supercedes the same relation on inherited mapper 'Mapper|DataSet|dataset'; this can cause dependency issu

Re: [sqlalchemy] Multi-column primary key with autoincrement?

2009-12-16 Thread Adrian von Bidder
Heyho! [multi-column primary key where one column is autoincrement int] On Wednesday 16 December 2009 05.29:54 Daniel Falk wrote: > The true problem here > is with sqlite, which tries to make a "smart" choice about whether to > autoincrement or not. And it gets it wrong. SQLAlchemy is correct