[sqlalchemy] Re: multiple table inheritance problem

2007-04-04 Thread Julien Cigar
svilen wrote: Julien Cigar wrote: Another quick question, relative to multiple inheritance. Is it common to keep a back reference to the parent class within the child class ? u mean theclass.__bases__? or what? The idea behind this is that I want to be able to retrieve

[sqlalchemy] Re: new features in 0.3.6

2007-04-04 Thread Glauco
Michael Bayer ha scritto: On Apr 3, 2007, at 11:26 AM, Glauco wrote: Yes, but i lost generative methods filter_by First of all, filter_by() has no interaction with instances(). with instances(), no SQL is constructed by the Query object - it takes the result set of

[sqlalchemy] Re: simple many-to-many select

2007-04-04 Thread Alexandre CONRAD
Okay, thanks. Any idea if .filter_by() and other new generative method will be available in an assign_mapper object? http://www.sqlalchemy.org/docs/plugins.html#plugins_assignmapper I'm figuring out that join_via and join_to will no longer be used as it's not documented anymore and will be

[sqlalchemy] Re: multiple table inheritance problem

2007-04-04 Thread svilen
if u have different attributes for different Content subtypes, then that means subclasses and eventualy polymorphism. Or u go the single_typee (singletable) way, and put all stuff in Content, and just check for presence/absence of some attributes. yep I have different attributes for

[sqlalchemy] Re: simple many-to-many select

2007-04-04 Thread Glauco
Alexandre CONRAD ha scritto: Okay, thanks. Any idea if .filter_by() and other new generative method will be available in an assign_mapper object? Yes..it's available, the final object has identical property as a mapper Glauco --

[sqlalchemy] Re: how to do many-to-many on the same table?

2007-04-04 Thread Sébastien LELONG
Hi, Hi, This is causing very messy code though, especially if youa re deleteing an article. Here is now i have it now. The flush is needed, or else i get an AssertionError saying SA is trying to flush 0 into a primary_key. Could you give more details ? I tried using the previous attached

[sqlalchemy] Re: simple many-to-many select

2007-04-04 Thread Alexandre CONRAD
Glauco wrote: Alexandre CONRAD ha scritto: Okay, thanks. Any idea if .filter_by() and other new generative method will be available in an assign_mapper object? Yes..it's available, the final object has identical property as a mapper Well, model.Client.filter_by(sites=siteobj) doesn't

[sqlalchemy] Re: how to do many-to-many on the same table?

2007-04-04 Thread Arnar Birgisson
Hi there, I haven't read the reast of the thread, but I asked a question here of how to represent a graph. What you need is essentialli an undirected graph. On 4/3/07, tml [EMAIL PROTECTED] wrote: So, if article 1 is related to article 2.. then there should be two rows in the

[sqlalchemy] Re: how to do many-to-many on the same table?

2007-04-04 Thread Arnar Birgisson
On 4/4/07, Arnar Birgisson [EMAIL PROTECTED] wrote: I often use a different technique. Instead of keeping two lines in the association table, I only keep one and make a rule that relateditem1 = relateditem2. Here is the thread on graphs where Mike posted a working solution:

[sqlalchemy] Disable autocreation of serial column with SA and postgres

2007-04-04 Thread Allen
Is there a way to have SA create an integer column in a postgres table that is a primary key without SA automatically creating it as type serial? I have a table like this: table = Table('my_table', meta, Column('id', Integer, primary_key=True), Column(name, String()) ) SA can create the

[sqlalchemy] Adding support for ESCAPE

2007-04-04 Thread Paul Kippes
Currently sqlalchemy doesn't support a query like this: SELECT my_name FROM names WHERE my_name LIKE 'larry\_%' ESCAPE '\' Could such a feature be added to be used in a similar way to the LIMIT feature? It looks like a simple enough patch for me to do. But I don't have knowledge of the array

[sqlalchemy] Re: 0.3.6 problem, was working with 0.3.4

2007-04-04 Thread Rick Morrison
Hi fw, The explicit zero for the float column was a bug that should be fixed in rev #2491. MSSQL can store low-resolution datetimes in DATE columns, and the format for MSSQL Date columns was expanded to allow storing those (note the missing seconds in the format). That date change should not

[sqlalchemy] Re: Automatic generation of changelog

2007-04-04 Thread Arnar Birgisson
Hi Mike, I've started looking into this and this is exactly what I need. I can pretty much eat the stuff directly from added_items() and deleted_items() and insert that into my history-log table. One question though: On 3/28/07, Michael Bayer [EMAIL PROTECTED] wrote: dont have an example

[sqlalchemy] Re: simple many-to-many select

2007-04-04 Thread Michael Bayer
My preference with assign_mapper at this point is to say: Client.query.filter_by(sites=siteobj) i.e. i dont think constantly adding methods to assignmapper is going to scale, as the chances of conflicts with existing user classes grows. im into hierarchies of names rather than huge

[sqlalchemy] Re: Adding support for ESCAPE

2007-04-04 Thread Michael Bayer
what is ESCAPE used for exactly (i.e. whats it going to do to that \ ?) ? what DB is this ? can this same functionality be achieved via bind parameters ? On Apr 4, 2007, at 10:30 AM, Paul Kippes wrote: Currently sqlalchemy doesn't support a query like this: SELECT my_name FROM names

[sqlalchemy] Re: Disable autocreation of serial column with SA and postgres

2007-04-04 Thread Michael Bayer
autoincrement=False on Column On Apr 4, 2007, at 10:11 AM, Allen wrote: Is there a way to have SA create an integer column in a postgres table that is a primary key without SA automatically creating it as type serial? I have a table like this: table = Table('my_table', meta,

[sqlalchemy] Re: Adding support for ESCAPE

2007-04-04 Thread Paul Kippes
It permits escaping of the wild LIKE characters _ and %. Say, for example, I have this column data: 1 larry_one 2 larry_two 3 larrysmall 4 larrybig 5 larry_small 6 larry_big SELECT my_name FROM names WHERE my_name LIKE 'larry_%' would return all the rows; but using SELECT my_name FROM names

[sqlalchemy] strange reference (appending to children)

2007-04-04 Thread ml
Hi! I found a quite strange behavior. Reproduction is simple. Setup: selfref=Table(selfref, metadata, Column(id,Integer, primary_key=True), Column(id_par,Integer, ForeignKey(selfref.id)) ) class SelfRef(object):pass mapper(SelfRef, selfref, properties={

[sqlalchemy] Re: Automatic generation of changelog

2007-04-04 Thread Arnar Birgisson
On 4/4/07, Michael Bayer [EMAIL PROTECTED] wrote: its not going to be able to modify the current flush() plan thats in progress, so youd either have to insert yourself, dispatch to class_mapper(HistoryLoggedItem).save_obj() yourself, or process the Session externally to the flush(), create

[sqlalchemy] Re: Adding support for ESCAPE

2007-04-04 Thread Michael Bayer
in postgres for example, \ is already the escape character, so you wouldnt need to say ESCAPE '\'. is this not the case in DB2 (we dont support DB2 anyway yet ?) ? if you want to provide a patch, this would be a keyword argument to the like() function, and would probably involve replacing

[sqlalchemy] Re: Adding support for ESCAPE

2007-04-04 Thread Paul Kippes
I've been using sqlite and as far as I know, it requires the ESCAPE clause. I'll take a stab at creating a patch this evening. On 4/4/07, Michael Bayer [EMAIL PROTECTED] wrote: in postgres for example, \ is already the escape character, so you wouldnt need to say ESCAPE '\'. is this not

[sqlalchemy] Is ILIKE supported?

2007-04-04 Thread Paul Kippes
In my version of sqlalchemy I didn't find any ability for ILIKE. Is this supported? If a patch is needed, would a new operator ilike be okay? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] Re: Is ILIKE supported?

2007-04-04 Thread Paul Johnston
Hi, Maybe I'm not understanding this. Is ILIKE only a mysql thing? So is LIKE normally case insensitive in complaint SQL database? ILIKE is quasi-standard. Postgres has it as well, but MSSQL doesn't - all LIKEs (and in equals too in fact) are case insensitive. Paul

[sqlalchemy] Re: Is ILIKE supported?

2007-04-04 Thread Andreas Kostyrka
Normally, like is case sensitive. if you want to query something case insensitive, one can use all kinds of expressions, one that comes to mind would be lower(col) like 'lowercase%' creating indexes on lower(col) would speed that up. Andreas * Paul Kippes [EMAIL PROTECTED] [070404 20:07]:

[sqlalchemy] Re: Is ILIKE supported?

2007-04-04 Thread Andreas Kostyrka
* Paul Johnston [EMAIL PROTECTED] [070404 20:11]: Hi, Maybe I'm not understanding this. Is ILIKE only a mysql thing? So is LIKE normally case insensitive in complaint SQL database? ILIKE is quasi-standard. Postgres has it as well, but MSSQL doesn't - all LIKEs (and in equals too

[sqlalchemy] Re: Is ILIKE supported?

2007-04-04 Thread Michael Bayer
theres a whole bunch of crap regarding case sensitivity in compares. at this point ive been asked about three thousand times for ILIKE so sure, we can add it...if we are adding a Like() construct, with a visit_like() in compiler, thats great; DB's that dont have ILIKE can pull out

[sqlalchemy] How would you build a mapper with a calculated field based on a join from two tables

2007-04-04 Thread vinjvinj
Say I have a python class defined: def class User(object): get_calculated_field(self): return self.a_column_in_user_table_1 + self.a_column_in_additional_info user_table = Table('user_table', metadata, autoload=True) additional_info = Table('additional_info', metadata,