[sqlalchemy] Re: Postgres MD Auth
On Jun 7, 3:10 am, Karsten Hilbert [EMAIL PROTECTED] wrote: On Thu, Jun 07, 2007 at 12:20:46AM -, Techniq wrote: Any reason why I can auth with psql and not the sqlachemy.dburi in Pylons? Yes, likely. I can see that the user, password, host, port are all passed correctly. These are the same parameters I use with psql to connect. I'm connecting from the same machine in both cases. psql -U username -h ip address databasename Works. sqlachemy.dburi = postgrs://username:password@ip address:5432/ databasename Doesn't work. How ? Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 initpsycopg: module initialization complete psyco_connect: dsn = 'dbname=csvpn_syslog host=X.X.X.X port=5432 user=guest password=,scrubbed' connection_setup: init connection object at 0x22d02f0, refcnt = 1 conn_connect: new postgresql connection at 0x1b4ac00 conn_connect: PQconnectdb(dbname=csvpn_syslog host=X.X.X.X port=5432 user=guest password=x) returned BAD connection_init: FAILED connection_dealloc: deleted connection object at 0x22d02f0, refcnt = 0 Traceback ... $ psql -U guest -h 192.168.1.50 -p 5432 csvpn_syslog Password for user guest: Welcome to psql 8.1.0 (server 8.1.3), the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit csvpn_syslog= --~--~-~--~~~---~--~~ 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] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: like doesn't work with objects
On Jun 6, 12:37 am, Mike Orr [EMAIL PROTECTED] wrote: On 6/5/07, Techniq [EMAIL PROTECTED] wrote: I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+peopl... and I'm discovering that even though 'model.class.c.column_name.like' is available it doesn't perform a LIKE in the query. from 'paster shell' In [20]: model.Accounting.select(model.Accounting.c.usr.like('TSmith')) Out[21]: [syslogsql.models.Accounting object at 0x2626d70, syslogsql.models.Accounting object at 0x2626ad0, syslogsql.models.Accounting object at 0x2626910] In [22]: model.Accounting.select(model.Accounting.c.usr.like('Smith')) Out[22]: [] ...BUT... In [23]: model.Accounting.select(model.Accounting.c.usr.like('%Smith %')) Out[27]: [syslogsql.models.Accounting object at 0x262d670, syslogsql.models.Accounting object at 0x2626d70, syslogsql.models.Accounting object at 0x2626ad0, syslogsql.models.Accounting object at 0x262d770, syslogsql.models.Accounting object at 0x262d790, syslogsql.models.Accounting object at 0x262d7b0, syslogsql.models.Accounting object at 0x2626910] Should I have to add the '%' around the string? What is the SQL in those cases? (engine.echo = True) Yes, you need the '%': column.like('%Smith%') The reason is that you may prefer the wildcard in a different position: '%son', 'ra%s'. It should work. I'm using an ORM query like that now, and I think I had a select query with .like before that. -- Mike Orr [EMAIL PROTECTED]\ OK, that's all I needed was to confirm that the '%' was required, I didn't think about having in in a diff position in the string, makes perfect sense. Thanks. --~--~-~--~~~---~--~~ 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] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Postgres MD Auth
Any reason why I can auth with psql and not the sqlachemy.dburi in Pylons? I can see that the user, password, host, port are all passed correctly. These are the same parameters I use with psql to connect. I'm connecting from the same machine in both cases. psql -U username -h ip address databasename Works. sqlachemy.dburi = postgrs://username:password@ip address:5432/ databasename Doesn't work. Ideas? --~--~-~--~~~---~--~~ 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] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] like doesn't work with objects
I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry and I'm discovering that even though 'model.class.c.column_name.like' is available it doesn't perform a LIKE in the query. from 'paster shell' In [20]: model.Accounting.select(model.Accounting.c.usr.like('TSmith')) Out[21]: [syslogsql.models.Accounting object at 0x2626d70, syslogsql.models.Accounting object at 0x2626ad0, syslogsql.models.Accounting object at 0x2626910] In [22]: model.Accounting.select(model.Accounting.c.usr.like('Smith')) Out[22]: [] ...BUT... In [23]: model.Accounting.select(model.Accounting.c.usr.like('%Smith %')) Out[27]: [syslogsql.models.Accounting object at 0x262d670, syslogsql.models.Accounting object at 0x2626d70, syslogsql.models.Accounting object at 0x2626ad0, syslogsql.models.Accounting object at 0x262d770, syslogsql.models.Accounting object at 0x262d790, syslogsql.models.Accounting object at 0x262d7b0, syslogsql.models.Accounting object at 0x2626910] Should I have to add the '%' around the string? --~--~-~--~~~---~--~~ 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] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---