[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-16 Thread Arun Kumar PG
Whooops. the problem in coming on the box which is running mysqldb1.2.0. Actually it's a non-upgraded server with mysqldb 1.2.0. I was looking at the code on my box which contains 1.2.2. But I am sure that even with mysqldb 1.2.0 the existing SA version was working fine. and that's why

[sqlalchemy] Re: mapping a joined table and ForeignKey functionality for session.save()

2007-08-16 Thread Michael Bayer
On Aug 16, 2007, at 12:23 AM, Boris Dušek wrote: Hi, I am using sqlalchemy like this: class Entry: pass table1 = sqa.Table('table1', meta, autoload=True) # this table has primary key 'id' table2 = sqa.Table('table2', meta, sqa.Column('table1_id', sqa.Integer,

[sqlalchemy] Re: sqlite unicode/datetime issue in 0.4

2007-08-16 Thread JP
Is there a different way to do this that's compatible with both versions, or is there a new 0.4 way of doing this, or have I just been doing something wrong all along and only 0.4 is catching it? DateTime objects in sqlite currently expect a datetime.datetime object, and not a string.

[sqlalchemy] Re: sqlite unicode/datetime issue in 0.4

2007-08-16 Thread Michael Bayer
On Aug 16, 10:06 am, JP [EMAIL PROTECTED] wrote: What's odd here is that I'm not setting the value myself -- it's getting set in pre_exec by the column default, which (I believe) is running the func in sqlite and returning the results, which I'd think should wind up with a

[sqlalchemy] Re: sqlite unicode/datetime issue in 0.4

2007-08-16 Thread Michael Bayer
ok thats in r3322 --~--~-~--~~~---~--~~ 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 to [EMAIL PROTECTED]

[sqlalchemy] Re: sqlite unicode/datetime issue in 0.4

2007-08-16 Thread JP
Yup, that fixed things. Thanks! On Aug 16, 10:49 am, Michael Bayer [EMAIL PROTECTED] wrote: ok thats in r3322 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread James
just to make sure I'm understanding this: even though mysql is configured to cascade deletes for this relationship, SA needs to be told about it so that it doesn't prevent it from cascading by first nulling the foreign key? I tried this: class Account(ActiveMapper): class mapping:

[sqlalchemy] sqlalchemy with turbogears and mapper

2007-08-16 Thread Lukasz Szybalski
Hello, I am setting up a website with existing database using turbogears. Database is in mysql. I am using sqlalchemy but I'm having problems with choosing the mapper? There is around 20 tables with a lot of foreign key, compound keys and alternative keys. Which mapper do I use? Can you point

[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread Michael Bayer
On Aug 16, 11:48 am, James [EMAIL PROTECTED] wrote: just to make sure I'm understanding this: even though mysql is configured to cascade deletes for this relationship, SA needs to be told about it so that it doesn't prevent it from cascading by first nulling the foreign key? yes more or

[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread James
I've seen some of the Elixir info and thought it was too new to start using just yet. How hard is it to transition from ActiveMapper to Elixir, given a moderately sized model and a moderate amount of access by controllers? If I go with direct access to SA API in model, where do the

[sqlalchemy] query.select vs .filter + .from_statement

2007-08-16 Thread svilen
i have a premade filtering clause and give it to a query.select at runtime. Sometimes its a simple x == 13 expression, another time it is a full sql-construct like polymorphic_union(). in 0.3 all went into .select(), but in 0.4 these 2 kinds seems split between .from_statement and .filter. so

[sqlalchemy] Re: query.select vs .filter + .from_statement

2007-08-16 Thread Michael Bayer
because we are going for more explicitness and less magic. when you start having methods that accept five different things, then people get confused which methods to use for what, it gets harder to check for correct arguments, etc. also, select_from() and from_statement() are not really

[sqlalchemy] Re: sqlalchemy with turbogears and mapper

2007-08-16 Thread Michael Bayer
hello - you generally use mapper() and relation() to set up how you'd like your classes to correspond to your table relationships. as far as compound keys, if they are defined with a primary key constraint you shouldn't have to worry about them. if you need to tell a mapper about some other

[sqlalchemy] empty unicode strings are not encoded

2007-08-16 Thread Christophe de VIENNE
Hi, I have a strange behavior (well, a blocking issue) on both sqlite and mssql with unicode strings. It inserting a empty unicode string, it's not encoded before being sent, while a non-empty string get encoded correctly. With sqlite it's not a problem, but with mssql it leads to a Invalid data

[sqlalchemy] Re: empty unicode strings are not encoded

2007-08-16 Thread Christophe de VIENNE
I forgot to mention that I'm using the latest svn trunk version, and that yesterday I was not having the problem, and although I did some upgrade of my system, I don't think they are related (yet?). 2007/8/16, Christophe de VIENNE [EMAIL PROTECTED]: Hi, I have a strange behavior (well, a

[sqlalchemy] Re: empty unicode strings are not encoded

2007-08-16 Thread Christophe de VIENNE
2007/8/16, Michael Bayer [EMAIL PROTECTED]: ok thats fixed in r3334. That was fast ! Thanks a lot. pushes my nice speed test back over the 1M function call mark :( Sorry about that... ;-) Cheers Christophe --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: sqlalchemy 0.4 beta3 released

2007-08-16 Thread Michael Bayer
0.4 has been in the trunk for a couple of weeks now (it was announced here and is mentioned on the site). so thats why the 0.4 branch hasnt changed. 0.3 is in /sqlalchemy/branches/rel_0_3. On Aug 16, 2007, at 4:42 PM, Boris Dušek wrote: Any idea when approximately can we expect the

[sqlalchemy] Does the SQL construction language support 'INSERT INTO' from a SELECT?

2007-08-16 Thread Barry Hart
I have an insert query in SQL where the records to be inserted are computed from a SELECT. Can I build this query in the SqlAlchemy query construction language? INSERT INTO product_current_promotion (promotion_id, product_id) SELECT promo_promotion.id, promo_promotion_items.product_id FROM

[sqlalchemy] Joining multiple tables

2007-08-16 Thread Vetle
Hi, I'm reading the documentation on SQL Alchemy, but perhaps I'm missing something here ... I need to join multiple tables, table1 with table2 and table1 again. So, in SQL, I'd do something like: select * from t1 join t2 on t1.b = t2.c join t1 t3 on t1.a = t3.a; Yeah, it doesn't make much

[sqlalchemy] Re: Does the SQL construction language support 'INSERT INTO' from a SELECT?

2007-08-16 Thread Michael Bayer
we've never added this particular construct since its usually used in migration scripts that are written as hand-coded SQL. ticket #722 was recently added for this feature add. for now, you can enter it using text() and theres also a workaround mentioned in that ticket.

[sqlalchemy] Re: Joining multiple tables

2007-08-16 Thread Michael Bayer
hi Vetle - the Table object supports a join() method, which can be called in a chain, i.e. table1.join(table2).join(table3)... if you need to specify the ON part of the join, its the second argument to join() (below illustrated with two joins back to table1): table1.join(table2,