[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-03-23 Thread az
let me think about it. as i see it u want to have runtime-invented data-only extensions to some object - or is it data + some algo about it? would the algos be new and reside in the new thing or they're just there and used? imo this should be done via joins ala pyprotocols; inheritance is more

[sqlalchemy] Re: MySQL error

2009-03-23 Thread morecowbell
it should. how/where are you setting up the tables? can you post the essential parts of your code? On Mar 22, 9:11 pm, pete.do...@gmail.com wrote: I am having trouble connecting to mysql database. I keep getting Programming error 1146 after trying to do a metadata.create_all(). I created the

[sqlalchemy] Weird error on upgrade to 0.5.2

2009-03-23 Thread Mike
Hi, I was using SqlAlchemy 0.5.0rc4 (and Python 2.5) on Ubuntu 8.10 and it was working great. Then one of my users upgraded to SA 0.5.2 and now one of my queries stopped working. Here's what my query looks like: code query = session.query(GE.ID, GE.FNAME, GE.LNAME,

[sqlalchemy] Re: Weird error on upgrade to 0.5.2

2009-03-23 Thread Michael Bayer
we'd need to know what stopped working means, and also note that our MSSQL support is strongest with pyodbc and not so much with adodbapi. Mike wrote: Hi, I was using SqlAlchemy 0.5.0rc4 (and Python 2.5) on Ubuntu 8.10 and it was working great. Then one of my users upgraded to SA 0.5.2 and

[sqlalchemy] Re: Weird error on upgrade to 0.5.2

2009-03-23 Thread Mike Driscoll
Oops...I thought I had copied the traceback in, but I forgot it...my bad. Here's the error: Traceback (most recent call last): File main.py, line 1461, in module app = Main(flag) File main.py, line 81, in __init__ self.createCtrls() File main.py, line 431, in createCtrls

[sqlalchemy] Re: MySQL error

2009-03-23 Thread Peter Douma
Here is the code I am using MySQL_Python 1.2.3 with Python 2.6 db = create_engine('mysql://root:passw...@localhost/dbase', echo = True) metadata = MetaData() user = Table( 'user',metadata, Column('id' ,Integer, primary_key = True), Column('password' ,String, nullable = True

[sqlalchemy] Re: Weird error on upgrade to 0.5.2

2009-03-23 Thread Mike Driscoll
Just an FYI: I put pyodbc 2.1.4 (and its dependencies) onto my Ubuntu test bed and SA is giving me the same error. Mike On Mar 23, 1:06 pm, Michael Bayer mike...@zzzcomputing.com wrote: we'd need to know what stopped working means, and also note that our MSSQL support is strongest with

[sqlalchemy] Re: Weird error on upgrade to 0.5.2

2009-03-23 Thread Michael Bayer
its almost certainly related to case sensitivity. note that SQLA makes a hard distinction between case sensitive and case insensitive names for tables and columns. by using all uppercase names, or MixedCase names, youre telling SQLA to quote all identifiers and match those names exactly.

[sqlalchemy] Best practices for using SQLAlchemy with generators?

2009-03-23 Thread Noah Gift
Does anyone have any recommendations for best practices for using SQLAlchemy with generators? While generators are quite nice for creating data processing pipelines, I wondered if anyone had any specific recommendations about potential, subtle, bottlenecks with SQLAlchemy to watch out for. --

[sqlalchemy] Bulk insert on related tables

2009-03-23 Thread George Sakkis
I've been trying to speed up a bulk insert process that currently seems too slow. I've read the past threads about how to replace the orm/session based inserts with table.insert().execute(*valuedicts) but in my case the objects are related (via 1-to-many relations if it makes a difference). In

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-03-23 Thread Christiaan Putter
Hi, You're quite right, the join was the tricky bit at first. Basically I construct an outer join over all the 'dynamic' extension classes. Here's an extract: def _get_selectable(self): j = None for key, val in HasTraitsORM._decl_class_registry.iteritems(): if

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-03-23 Thread az
On Monday 23 March 2009 23:51:26 Christiaan Putter wrote: Hi, You're quite right, the join was the tricky bit at first. ... The 'dynamically' added classes look something like this: class SMAFields(SecurityFields): sma10 = Float(sqldb=True) def _get_sma10(self):

[sqlalchemy] Re: MySQL error

2009-03-23 Thread morecowbell
since you're using mysql you got specify the the length for each string, e.g., String(40); http://www.sqlalchemy.org/docs/05/ormtutorial.html#define-and-create-a-table On Mar 23, 1:49 pm, Peter Douma pete.do...@gmail.com wrote: Here is the code I am using MySQL_Python 1.2.3 with Python 2.6

[sqlalchemy] eagerload first in relation?

2009-03-23 Thread David Gardner
I have a simple many to many relationship between two objects: Task and Note, where notes are ordered by a timestamp column most recent first. About 90% of the time what I really want to do is eagerload only the most recent note, is there a way to do this in the mapper? My mapper for Task

[sqlalchemy] Re: eagerload first in relation?

2009-03-23 Thread Michael Bayer
the relational way to do this is to select the note with a date matching the most recent date in the view of notes. you can perhaps also make a viewonly relation() that selects something similar, like: recent_notes = select([func.max(note_table.c.updated).label('updated'),