[sqlalchemy] Re: Multiple Inheritance

2008-09-04 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] Re: Accessing Views with SqlAlchemy

2008-09-04 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 solution.

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

2008-09-04 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: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Brickenstein
and here is the new traceback ;-) Traceback (most recent call last): File foo.py, line 38, in module DBSession.flush() File /Users/michael/programming/rumdemo3/lib/python2.5/site- packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/scoping.py, line 106, in do return

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

2008-09-04 Thread Wim Verhavert
Thanks for the quick answers. But I'm left with some side-effect I'm a little bit struggling with: in order for this to work myObject and myOtherObject need to inherit some base class let's say 'entity'. Now the ones who created the database clearly didn't had much experience with databases (damn

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

2008-09-04 Thread az
AFAIK for the single inh. your object hierarchy makes no difference - it all goes in one table, regardless if it is one class of whole tree of not-realy-related-ones. what is the python side of things is up to you. why is that entity base class bothering you? declare it just inheriting object

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

2008-09-04 Thread Wim Verhavert
Well let me be more concrete, I'll show you part of the mess I'm in: We have persons, called contacts, and departments. For some crazy reason the previous designers put them all in one table (called 'contacts' can you believe this?!). Now they share almost nothing but a name. There all kinds of

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

2008-09-04 Thread az
thats still not much of a mess, at least u have 5 tables and not 500. see, i've never used single table inh, and i'm not sql fan at all - thats why i made dbcook.sf.net - but maybe it looks like: entity_table = Table('contacts', metadata, Column('id', Integer, primary_key=True),

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

2008-09-04 Thread Wim Verhavert
Thanks for the response. I will read into the docs a little bit more and let you know what I came up with... On Thu, Sep 4, 2008 at 11:32 AM, [EMAIL PROTECTED] wrote: thats still not much of a mess, at least u have 5 tables and not 500. see, i've never used single table inh, and i'm not sql

[sqlalchemy] Comparing tuples

2008-09-04 Thread Christoph Zwerschke
Is there a simple way of comparing tuples in the SQLAlchemy query language, like (User.last_name, User.first_name) ('Joe', 'Doe')? SQL-wise it is possible (at least with PostgreSQL), but you cannot write this as a filter expression. -- Christoph

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Michael Bayer
On Sep 3, 2008, at 11:25 PM, Michael Bayer wrote: This pattern doesnt entirely make sense - the citizen_type and employee_type columns seem superfluous and redundant against each other, since we really can't load Engineer rows without querying all three tables. In that sense it takes on

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 4:15 AM, Michael Brickenstein wrote: AssertionError: Dependency rule tried to blank-out primary key column 'project_programming_language.programming_language_id' on instance '[EMAIL PROTECTED]' the project_programming_language table's primary key is

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

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 1:39 AM, gniquil wrote: documented. The sqlalchemy expression language can't really do very well here either (at least too proprietary in some ways...sort of like working with pylons versus working with a CMS like Plone, which both can be used to create a blog, but one

[sqlalchemy] Re: Comparing tuples

2008-09-04 Thread Christoph Zwerschke
Is there a simple way of comparing tuples in the SQLAlchemy query language, like (User.last_name, User.first_name) ('Joe', 'Doe')? SQL-wise it is possible (at least with PostgreSQL), but you cannot write this as a filter expression. Tried the following, but it does not work: print

[sqlalchemy] Re: using the native c implementation of ordereddict

2008-09-04 Thread az
On Thursday 04 September 2008 15:42:56 Michael Bayer wrote: On Sep 4, 2008, at 12:40 AM, gniquil wrote: 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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Brickenstein
Dear Michael! Thanks, I got it and understand the difference now. Thank you very much for your help and your time. Michael Am 04.09.2008 um 14:35 schrieb Michael Bayer: On Sep 4, 2008, at 4:15 AM, Michael Brickenstein wrote: AssertionError: Dependency rule tried to blank-out primary key

[sqlalchemy] Re: Comparing tuples

2008-09-04 Thread Christoph Zwerschke
This does not work either: print session.query(User).filter( text((last_name, first_name) (%(last_name)s, %(first_name)s), )).params(first_name='Joe', last_name='Doe').all() Running out of ideas... -- Christoph --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: Comparing tuples

2008-09-04 Thread Michael Bayer
just use the plain string and not text(), and use :paramname as the bind param format. example is here: http://www.sqlalchemy.org/docs/05/ormtutorial.html#datamapping_querying_using On Sep 4, 2008, at 9:25 AM, Christoph Zwerschke wrote: This does not work either: print

[sqlalchemy] Re: using the native c implementation of ordereddict

2008-09-04 Thread jason kirtland
Michael Bayer wrote: On Sep 4, 2008, at 12:40 AM, gniquil wrote: 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

[sqlalchemy] Re: Comparing tuples

2008-09-04 Thread Christoph Zwerschke
Michael Bayer schrieb: just use the plain string and not text(), and use :paramname as the bind param format. example is here: http://www.sqlalchemy.org/docs/05/ormtutorial.html#datamapping_querying_using Excellent, that works: print session.query(User).filter( (last_name,

[sqlalchemy] Re: using the native c implementation of ordereddict

2008-09-04 Thread az
On Thursday 04 September 2008 17:51:56 Michael Bayer wrote: On Sep 4, 2008, at 9:03 AM, [EMAIL PROTECTED] wrote: i used to set sqlalchemy.util.Set to be sqlalchemy.util.OrderedSet and that worked well... if all those basic things (dict, set, odict, oset, etc) are always routed via

[sqlalchemy] Re: csv engine?

2008-09-04 Thread Michael Bayer
On Sep 3, 2008, at 4:25 PM, Lukasz Szybalski wrote: 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.

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Sam Magister
Michael, Thanks for the thoughtful replies. I'm going to explore the options you raised here. I'll post back with any insights I come to. Best, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group.

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Sam Magister
On Sep 3, 8:25 pm, Michael Bayer [EMAIL PROTECTED] wrote: You can certainly map to any of the hierarchies indicated in that   article, but you wouldn't be able to take advantage of SQLA's   polymorphic capabilities, which are designed to only handle single   inheritance.   You'd really want

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Michael Bayer
sorry for the rant. my second response is closer to the mark. On Sep 4, 2008, at 2:01 PM, Sam Magister wrote: Michael, Thanks for the thoughtful replies. I'm going to explore the options you raised here. I'll post back with any insights I come to. Best, Sam

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 2:12 PM, Sam Magister wrote: Michael, what would the mapper function look like if it were to map Engineer(Employee, Citizen) to engineers.join(citizens).join(employees). What argument of the mapper would that join condition be in? I think concrete inheritance might be

[sqlalchemy] Translating a complex SQL Statement to SqlAlchemy

2008-09-04 Thread Mike
Hi, I am trying to translate the following SQL into SqlAlchemy session syntax: sql = ''' SELECT SUM(reg), SUM(ot), SUM(ce), SUM(hol), SUM(sklv), SUM(vac), SUM(ct), SUM(conv), SUM(misc) FROM tbl_TimeEntries WHERE dateworked = '%s' AND dateworked = '%s' AND empid = %s

[sqlalchemy] Re: Translating a complex SQL Statement to SqlAlchemy

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 3:14 PM, Mike wrote: Hi, I am trying to translate the following SQL into SqlAlchemy session syntax: sql = ''' SELECT SUM(reg), SUM(ot), SUM(ce), SUM(hol), SUM(sklv), SUM(vac), SUM(ct), SUM(conv), SUM(misc) FROM tbl_TimeEntries WHERE dateworked

[sqlalchemy] Re: Translating a complex SQL Statement to SqlAlchemy

2008-09-04 Thread Mike
Hi, On Sep 4, 2:32 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 4, 2008, at 3:14 PM, Mike wrote: Hi, I am trying to translate the following SQL into SqlAlchemy session syntax: sql = ''' SELECT SUM(reg), SUM(ot), SUM(ce), SUM(hol), SUM(sklv), SUM(vac), SUM(ct), SUM(conv),

[sqlalchemy] bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
I'm using 0.4.6 but I thought I'd give 0.5b3 a try. An existing (working) query failed with: Query.__no_criterion() being called on a Query with existing criterion. I tracked that down to using order_by when building the query. An example is below: q = dbsess.query(Obj) q =

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 4:17 PM, Jon wrote: I'm using 0.4.6 but I thought I'd give 0.5b3 a try. An existing (working) query failed with: Query.__no_criterion() being called on a Query with existing criterion. I tracked that down to using order_by when building the query. An example is

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 4:32 PM, Michael Bayer wrote: On Sep 4, 2008, at 4:17 PM, Jon wrote: I'm using 0.4.6 but I thought I'd give 0.5b3 a try. An existing (working) query failed with: Query.__no_criterion() being called on a Query with existing criterion. I tracked that down to using

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 3:32 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 4, 2008, at 4:17 PM, Jon wrote: I'm using 0.4.6 but I thought I'd give 0.5b3 a try. An existing (working) query failed with: Query.__no_criterion() being called on a Query with existing criterion. I tracked that

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 4:33 pm, Jon [EMAIL PROTECTED] wrote: On Sep 4, 3:32 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 4, 2008, at 4:17 PM, Jon wrote: I'm using 0.4.6 but I thought I'd give 0.5b3 a try. An existing (working) query failed with: Query.__no_criterion() being called on

[sqlalchemy] mssql unicode weirdness: empty nvarchar string is selected as u

2008-09-04 Thread desmaj
I'm setting up my first project that will use SA exclusively for database access and I've run into some behavior that seems odd to me. If I insert u into a column that is defined as nvarchar then when I select that column, I receive u . So I'm receiving a unicode string containing one space

[sqlalchemy] Re: mssql unicode weirdness: empty nvarchar string is selected as u

2008-09-04 Thread desmaj
Almost forgot: I'm working against SQL Server 2000. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group,

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 5:33 PM, Jon wrote: I'll note that if I use something like this in the ORM mapper definition: order_by=meta.tables['some_table'].c.some_column, get(pkey) continues to work *and* ORDER BY is used in the SQL. While ORDER BY doesn't make sense when acquiring just

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 5:31 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 4, 2008, at 5:33 PM, Jon wrote: I'll note that if I use something like this in the ORM mapper definition:      order_by=meta.tables['some_table'].c.some_column, get(pkey) continues to work *and* ORDER BY is used in the

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 5:55 PM, Jon wrote: I'll note that I find building a single query for potentially several uses quite handy, whether I'm doing a get() or an additional filter/ filter_by. By prebuilding as much of the query as possible I reduce the overall complexity of my applications,

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 6:38 PM, Jon wrote: I'd still like to request that order by be allowed - there is a big difference between makes no sense and is an error. At the moment I'm pretty convinced that allowing makes no sense to pass through silently is poor behavior.

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
as usual, since this one might turn out to be pretty controversial, I welcome the list to comment on this one. The order_by().get() idea does fall in the category of nonsensical as opposed to ambiguous , perhaps thats the distinction we'd want to go on.

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 5:54 pm, Michael Bayer [EMAIL PROTECTED] wrote: as usual, since this one might turn out to be pretty controversial, I   welcome the list to comment on this one.   The order_by().get() idea   does fall in the category of nonsensical as opposed to ambiguous ,   perhaps thats the

[sqlalchemy] Inserts using reflection...

2008-09-04 Thread Sam
I woke up today and decided it was time to switch one of my simpler programs from sqlobject to sqlalchemy. I'm using reflection. After some googling I was able to find a way to insert: mp = mphones.insert().execute(word=word, mphone=phone) The above works okay. But I'd rather be able to do

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 7:19 PM, Jon wrote: In your specific case, I don't see what's so hard about creating a Query which has *only* those aspects which make sense both to a get() as well as a join()/order_by() combination (in this case the eagerload options), and passing that to further

[sqlalchemy] Re: Inserts using reflection...

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 7:16 PM, Sam wrote: I woke up today and decided it was time to switch one of my simpler programs from sqlobject to sqlalchemy. I'm using reflection. After some googling I was able to find a way to insert: mp = mphones.insert().execute(word=word, mphone=phone) The

[sqlalchemy] When the database is to support sql 2005 ?

2008-09-04 Thread guge
When the database is to support sql 2005 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 7:01 pm, Michael Bayer [EMAIL PROTECTED] wrote: In this case it means a doubling of the number of queries I already have, and those queries are indexed by name. Since the queries (sometimes fairly complex) would be almost exactly the same it would actually make things much

[sqlalchemy] Re: Inserts using reflection...

2008-09-04 Thread Sam
Michael... I've read the tutorial, and I think I understand it. But maybe I don't understand reflection. I thought that I could use it to avoid defining anything. I'd like to have objects basically spring into life knowing exactly what their row names are, without having to type anything. Am

{IT-Reks} 2 REKS FOR SR JAVA DEVELOPER WITH MARKET DATA EXP MUST AT NY

2008-09-04 Thread Recruiter
*PLEASE LET ME KNOW IF YOU HAVE ANY JAVA DEVELOPERS WITH MARKET DATA EXP AT NY* LOCATION : NY DURATION : 1 YEAR *1) **We are looking for a senior Java, J2EE developer to join business focused Prime Brokerage Technology team*. *Role is to do development, building the trade capture application,