[sqlalchemy] Querying against the remote side of a ManyToMany

2008-09-17 Thread Alec Thomas
From the example here: http://www.sqlalchemy.org/docs/04/documentation.html#datamapping_manytomany How can i construct a query that will return the keywords for posts from a particular user? I'd expect this to work: session.query(Keyword).join(BlogPost.keywords) \

[sqlalchemy] Re: generative queries

2008-09-17 Thread Grimsqueaker
Im using 0.4.5, is this feature only available in 0.5? On Sep 16, 4:02 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 16, 2008, at 3:51 AM, Grimsqueaker wrote: I'm having some trouble using generative queries. In my case, I want to compile a query and then add further from (join)

[sqlalchemy] Re: Declarative documentation

2008-09-17 Thread Empty
Hi Doug, I'm a new user (like this week) of SqlAlchemy and I'm trying to find more information about using the Declarative system. In particular I'm trying to build a hierarchical table with one-to-many relationships within the table. So if anyone knows where there might be some additional

[sqlalchemy] text() TextClauses and like literals

2008-09-17 Thread Mark Mitchell
I'm having an issue I'm curious if anyone else has come across. When I use a like SQL expression within a text() clause, I receive the following exception: ... [my app code] ... File '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/ sqlalchemy/engine/base.py', line 838 in scalar

[sqlalchemy] Re: Querying against the remote side of a ManyToMany

2008-09-17 Thread Michael Bayer
On Sep 17, 2008, at 3:35 AM, Alec Thomas wrote: From the example here: http://www.sqlalchemy.org/docs/04/documentation.html#datamapping_manytomany How can i construct a query that will return the keywords for posts from a particular user? I'd expect this to work:

[sqlalchemy] Problem using utf-8

2008-09-17 Thread Jürgen Hauptmann
Hi Im using utf-8 in my mysql tables. If i insert a String with German Umlaute like Ü it is converted to Ãœ in the database, it ist returned as Ü. - What can i do that this will be correctly saved? my connection looks like this: engine = create_engine('mysql://xxx:[EMAIL PROTECTED]/test123',

[sqlalchemy] Re: generative queries

2008-09-17 Thread Michael Bayer
On Sep 17, 2008, at 8:57 AM, Empty wrote: Hello, Im using 0.4.5, is this feature only available in 0.5? Yes, it's not available in 0.4.5. There is the predecessor _values available in 0.4.5. It was experimental and it's behavior has changed somewhat but will basically do the same

[sqlalchemy] Re: text() TextClauses and like literals

2008-09-17 Thread Michael Bayer
On Sep 17, 2008, at 9:19 AM, Mark Mitchell wrote: The code to replicate this exception is pretty simple: count = con.scalar(select(['count(*)'], from_obj=my_table, whereclause=text('mytable.column like \'%\'')) That is my error, here is my

[sqlalchemy] Re: text() TextClauses and like literals

2008-09-17 Thread Mark Mitchell
Thanks! That is good to know. Having trouble finding the docs for psycopg2 -- any idea off the top of your head what the escape syntax is for %? (When I put in '%%', pyscopg2 outputted %%, not %, to postgres (but didn't throw the exception)). I found the home page for pyscopg2 but no docs.

[sqlalchemy] Re: Problem using utf-8

2008-09-17 Thread Bo Shi
I ran into a similar issue using MySQL-python-1.2.1_p2-1 (mysqldb) with SA 0.4.2p3-1. http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg00373.html might shed some more light on this issue which might be a double encoding problem? Here is the subset of relevant keyword arguments we use

[sqlalchemy] Re: Declarative documentation

2008-09-17 Thread Doug Farrell
Michael, Thanks for getting back to me so quickly. I've figured out how to get a one-to-many, single table relationship working with one way relations, here is that configuration: class JobData(Base): __tablename__ = jobs id = Column(Integer, primary_key=True, autoincrement=True)

[sqlalchemy] Re: Problem using utf-8

2008-09-17 Thread Michael Bayer
On Sep 17, 2008, at 10:50 AM, Bo Shi wrote: I ran into a similar issue using MySQL-python-1.2.1_p2-1 (mysqldb) with SA 0.4.2p3-1. I would advise upgrading to MySQL-python 1.2.2. I believe some utf-8 issues have been fixed. --~--~-~--~~~---~--~~ You

[sqlalchemy] MySQL String with no length broken as of r4705

2008-09-17 Thread Kevin Dangoor
I have some of my columns defined as Column('foo', Unicode). This worked fine with MySQL, but a change made in r4705 appears to have broken this. Prior to 4705, that would generate a TEXT column in the create table. This was switched to just VARCHAR. MySQL 5.0.45 does not accept VARCHAR without

[sqlalchemy] Re: MySQL String with no length broken as of r4705

2008-09-17 Thread Kevin Dangoor
Hi Mike, On Sep 17, 1:53 pm, Michael Bayer [EMAIL PROTECTED] wrote: We've strictified the difference between String() and Text() in 0.5   such that String() doesn't implicitly go from VARCHAR to TEXT without   a length.   So in your case you want to use UnicodeText. OK, I guess that's

[sqlalchemy] Re: MySQL String with no length broken as of r4705

2008-09-17 Thread Michael Bayer
On Sep 17, 2008, at 3:18 PM, Kevin Dangoor wrote: Hi Mike, On Sep 17, 1:53 pm, Michael Bayer [EMAIL PROTECTED] wrote: We've strictified the difference between String() and Text() in 0.5 such that String() doesn't implicitly go from VARCHAR to TEXT without a length. So in your case you

[sqlalchemy] Re: MySQL String with no length broken as of r4705

2008-09-17 Thread Kevin Dangoor
On Sep 17, 4:21 pm, Michael Bayer [EMAIL PROTECTED] wrote: some databases do accept VARCHAR without a length. But the code I was looking at is in mysql.py, so I was assuming this is where database-specific behavior goes.  Also, its a valid   use case to use String/VARCHAR by itself without a