[sqlalchemy] Re: default values for columns in select mappers

2008-09-03 Thread az
see (single) table inheritance and the rest, http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_inheritance On Wednesday 03 September 2008 21:59:28 [EMAIL PROTECTED] wrote: > Hi all, > > I just started playing with SQLAlchemy today (after several years > of plain SQL experience

[sqlalchemy] Re: Accessing Views with SqlAlchemy

2008-09-03 Thread az
put a class ABC(object): pass and see what it gets filled with? On Thursday 04 September 2008 00:10:44 Mike wrote: > On Sep 3, 3:45 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > > On Sep 3, 2008, at 4:14 PM, Mike wrote: > > > Replying to my own message seems kind of schizo, but I found > > > one

[sqlalchemy] Re: Multiple Inheritance

2008-09-03 Thread az
i went for polymorphic asociation on my multiple inheritances / multiple aspects. it gives even more freedom than what strict inheritance needs. the examples around ruby-on-rails are for one2many/many2one: http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations sqlalchemy/

[sqlalchemy] sql templating for those sql lovers (or just people who work with dirty legacy "enterprise" data)

2008-09-03 Thread gniquil
Hi all, I've been thinking about using mako as a sql templating engine to dynamically generate sql. The reason for this is that recently I've realized 90% of time is really spent on generating some kind of analytic views (materialized into materialized views or tables) on existing oracle tables.

[sqlalchemy] using the native c implementation of ordereddict

2008-09-03 Thread gniquil
Hi All, I am doing some work with xmlrpc. One thing I realize is that whenever I pass dict(row) through xmlrpc, I get an key-ordered struct. But this isn't what i really want. What I want is ordered by insertion or the original list order. This led me to look at the util.ordereddict implementatio

[sqlalchemy] Re: Multiple Inheritance

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 8:47 PM, Sam Magister wrote: > > I was wondering if it is possible to set up joined table inheritance > so that a subclass inherits from more than one base table. To extend > the example given in the documentation, we would have a base class > 'Employee' and a base class 'Citi

[sqlalchemy] Re: JOINING

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 6:06 PM, mg wrote: > > So what I am understanding is that right now, SA only does LEFT OUTER > JOINS? Or am I misunderstanding? The "eager load" feature of a relation(), which is responsible for loading the child items on a collection, does only OUTER JOIN, since its assu

[sqlalchemy] Multiple Inheritance

2008-09-03 Thread Sam Magister
I was wondering if it is possible to set up joined table inheritance so that a subclass inherits from more than one base table. To extend the example given in the documentation, we would have a base class 'Employee' and a base class 'Citizen' such that an 'Engineer' would inherit from both Employe

[sqlalchemy] Re: JOINING

2008-09-03 Thread mg
So what I am understanding is that right now, SA only does LEFT OUTER JOINS? Or am I misunderstanding? thanks, Matt On Sep 3, 3:49 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 3, 2008, at 3:26 PM, mg wrote: > > > > > > > here is my code: > > c_table = Table('campaign', metadata, > >    

[sqlalchemy] Re: Accessing Views with SqlAlchemy

2008-09-03 Thread Mike
On Sep 3, 3:45 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 3, 2008, at 4:14 PM, Mike wrote: > > > > > Replying to my own message seems kind of schizo, but I found one > > solution. I reflected the view into a Table() object and then used the > > "select" method along with "and_" and "no

[sqlalchemy] Accessing Views with SqlAlchemy

2008-09-03 Thread Mike
Hi, I need to interface with a couple of Views in Microsoft SQL Server 2000. How do I go about doing this with SqlAlchemy? Since a View doesn't have columns per se, how do I go about creating a class and a table object to map them? I tried my Google-Fu, but there's not much out there on this sub

[sqlalchemy] Re: Accessing Views with SqlAlchemy

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 4:14 PM, Mike wrote: > Replying to my own message seems kind of schizo, but I found one > solution. I reflected the view into a Table() object and then used the > "select" method along with "and_" and "not_". I would prefer to use > the session object, but this works. > > I'm

[sqlalchemy] Re: JOINING

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 3:26 PM, mg wrote: > > here is my code: > c_table = Table('campaign', metadata, >Column('id', Integer, primary_key=True), >Column('content', Unicode(200)), > ) > > m_table = Table('mailings', metadata, >Column('id', Integer, primary_key=True), >Column('campaign

[sqlalchemy] csv engine?

2008-09-03 Thread Lukasz Szybalski
Hello, I was wondering if there are any plans to have a csv engine for sqlalchemy. I would like to see support for csv. There are some cases where csv is the best way to convert data to and from especially when they require cleaning. What I would like to see is a sqlalchemy wrapping over csv modul

[sqlalchemy] Re: Accessing Views with SqlAlchemy

2008-09-03 Thread Mike
On Sep 3, 11:29 am, Mike <[EMAIL PROTECTED]> wrote: > Hi, > > I need to interface with a couple of Views in Microsoft SQL Server > 2000. How do I go about doing this with SqlAlchemy? Since a View > doesn't have columns per se, how do I go about creating a class and a > table object to map them?

[sqlalchemy] Re: SA and Filemaker Pro

2008-09-03 Thread KMCB
Michael, I had thought that may be the case, so I had already started with the databases/mssql.py file. Do you think that is the best place to start? Is SA structured that all DB specific components are stored in that location? Just trying to scope the effort from my end, any thoughts are appr

[sqlalchemy] Re: default values for columns in select mappers

2008-09-03 Thread Wim Verhavert
Thanks! That's indeed the stuff I was looking for! On Wed, Sep 3, 2008 at 9:23 PM, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > On Sep 3, 2008, at 2:59 PM, [EMAIL PROTECTED] wrote: > >> >> I have 1 table (mytable) which is structured somewhat like this: >> id = int (primary key) >> name = varch

[sqlalchemy] Re: default values for columns in select mappers

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 2:59 PM, [EMAIL PROTECTED] wrote: > > I have 1 table (mytable) which is structured somewhat like this: > id = int (primary key) > name = varchar() > type = int > > Now all rows with a type, say 1 'constitute' a MyObject. And rows with > type say 2 are MyOtherObject instances,

[sqlalchemy] JOINING

2008-09-03 Thread mg
here is my code: c_table = Table('campaign', metadata, Column('id', Integer, primary_key=True), Column('content', Unicode(200)), ) m_table = Table('mailings', metadata, Column('id', Integer, primary_key=True), Column('campaign_id',Integer, ForeignKey('campaign.id')), Column('d

[sqlalchemy] default values for columns in select mappers

2008-09-03 Thread wim . verhavert
Hi all, I just started playing with SQLAlchemy today (after several years of plain SQL experience) and I must say I'm impressed. I'm reading my way through the docs now, but there is one thing I can't seem to find. Let me briefly explain the situation. I was given the task of rewriting a databas

[sqlalchemy] Re: Concatenating column names and text() clauses

2008-09-03 Thread Jeff
On Sep 3, 11:55 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 3, 2008, at 11:09 AM, Jeff wrote: > > > > > > >> in general, text() is intended primarily for fully constructed SQL > >> statements, and does not implement the semantics of an element used > >> within an expression.  For individ

[sqlalchemy] Re: Concatenating column names and text() clauses

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 11:09 AM, Jeff wrote: >> >> in general, text() is intended primarily for fully constructed SQL >> statements, and does not implement the semantics of an element used >> within an expression. For individual literal components, use the >> literal() function which produces a bin

[sqlalchemy] Re: Concatenating column names and text() clauses

2008-09-03 Thread Jeff
On Aug 21, 5:25 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Aug 21, 2008, at 4:28 PM, Jeff wrote: > > > > > > > Hello.  I'm trying to writing something to generate full text searches > > for postgres.  Here's the function I've got so far: > > > from sqlalchemy import sql > > import operator

[sqlalchemy] Re: SA and Filemaker Pro

2008-09-03 Thread Michael Bayer
On Sep 3, 2008, at 8:58 AM, KMCB wrote: > > Michael, > > I had thought that may be the case, so I had already started with the > databases/mssql.py file. Do you think that is the best place to > start? Is SA structured that all DB specific components are stored in > that location? Just trying