[sqlalchemy] Re: Column aliases

2007-01-19 Thread Jose Soares
I think I have a similar trouble, although the symptoms are different. I have a PostgreSQL table named 'acl' mapped as UserGroup. Table acl Column| Type --+- id | integer id_operatore | integer cod_ruolo| text id_asl | integer id_azienda

[sqlalchemy] Re: Full Text Search using PostgreSQL and tsearch2

2007-01-19 Thread Sanjay
Thanks a lot, guys. Will try a sample application and post in the wiki. Might take some time - meanwhile, if somebody gets some more stuff, posting it would help. thanks sanjay --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-19 Thread svilen
if you read closely, you can see that the embedded query for selecting the employee is wrong; it has no FROM clause: SELECT Employee.id AS id, Employee.name AS name, Employee.atype AS atype, Employee.manager_id AS manager_id \nWHERE Employee.atype = ? SQLite is a little dumb in that it doesnt

[sqlalchemy] Using .label() on boolean expressions

2007-01-19 Thread King Simon-NFHD78
Hi, I don't know if this is valid SQL, but MySQL seems to accept it... I'd like to write a query that looks like: SELECT s.result LIKE 'Pass%' AS pass ... Which would return 1 or 0 for each row depending on whether the result column begins with Pass. In SQLAlchemy this would become:

[sqlalchemy] Re: Using .label() on boolean expressions

2007-01-19 Thread King Simon-NFHD78
Simon King wrote: I don't know if this is valid SQL, but MySQL seems to accept it... I'd like to write a query that looks like: SELECT s.result LIKE 'Pass%' AS pass ... Which would return 1 or 0 for each row depending on whether the result column begins with Pass. Another way I

[sqlalchemy] Re: Column aliases

2007-01-19 Thread Michael Bayer
in both of these cases, a particular Column can only be expressed on the Mapper once. I should add some error checking to Mapper to insure that this is followed. The reason is simple: if a class has two attributes a and b which both point to a column C, and I set a to 5 and b to 7 and

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-19 Thread Michael Bayer
sum up for me what the current bugs youre observing are. the foreignkey parameter is definitely needed for some of your cases. it un-ambiguates which column in the join condition is remote, for a join where its otherwise not clear. On Jan 19, 2007, at 7:32 AM, svilen wrote: and that

[sqlalchemy] Re: Using .label() on boolean expressions

2007-01-19 Thread Michael Bayer
I just changed the inheritance of BooleanExpression to be from BinaryExpression so it retains all the semantics of a BinaryExpression, rev 2217. this required a slight tweak in the orm's Query.select() method to properly detect a where criterion but was otherwise not a big deal. On

[sqlalchemy] Re: Using .label() on boolean expressions

2007-01-19 Thread Michael Bayer
On Jan 19, 2007, at 11:49 AM, King Simon-NFHD78 wrote: because that would be a function rather than a boolean expression, and functions can be labelled. I knew I couldn't call 'sa.func.if', but I thought it would be nice if you could use sa.func.if_ - the _FunctionGateway object could strip

[sqlalchemy] Re: Column aliases

2007-01-19 Thread jose
I tried this class UserGroup(DomainObject): pass assign_mapper(context, UserGroup, tbl['acl'], properties = { 'id_operatore': tbl['acl'].c.id_operatore, 'user_id' : synonym('id_operatore', proxy=True), 'cod_ruolo' :

[sqlalchemy] Re: Column aliases

2007-01-19 Thread Michael Bayer
thanks for testing that for me. added a fix + unit test in rev 2219. On Jan 19, 2007, at 4:48 PM, jose wrote: I tried this class UserGroup(DomainObject): pass assign_mapper(context, UserGroup, tbl['acl'], properties = { 'id_operatore': tbl

[sqlalchemy] Re: how to find out the last insert id ?

2007-01-19 Thread jose
Michael Bayer wrote: dischdennis wrote: what is the easiest way to find out the last insert id? (MySQL 5) supplast = select([func.last_insert_id()],app_schema.SupplierTable.c.pr_supplier_ID 0).execute().fetchone()[0] does not work for some reason Dennis result =