[sqlalchemy] Re: sqlalchemy.orm.attributes.InstrumentedList

2007-04-16 Thread Disrupt07
@svilen 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

[sqlalchemy] Re: order_by

2007-04-16 Thread ml
e.g. order_by = [desc(table1.mycol)] Disrupt07 napsal(a): In my table I have a column with type Boolean. When using order_by on this column I am getting the results as follows: False False True True True ... True I want them the other way round (the True first, then the False).

[sqlalchemy] Re: order_by

2007-04-16 Thread Disrupt07
@ml 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

[sqlalchemy] Stuck creating a custom relation using ActiveMapper

2007-04-16 Thread Paul Johnston
Hi, I'm trying to create a relation like this Testing [1] - [many] Target (where target.is_testtgt==0) i.e. I want to map only to Target rows that match the where condition. Now, this is easy enough using assign_mapper: assign_mapper(ctx, Testing, testing, properties={ 'targets':

[sqlalchemy] connecting to ODBC backed by MS-SQL?

2007-04-16 Thread Victor Ng
Is there a simple example of how to connect to a SQL Server instance using SQLAlchemy and the adodbapi module? Searching in this group didn't seem to find any concrete examples of the connection string I need to connect to an ODBC datasource. vic

[sqlalchemy] Re: connecting to ODBC backed by MS-SQL?

2007-04-16 Thread Victor Ng
Ach my sqlserver instance seems to just take a long time and I'm too impatient. create_engine('mssql://localhost/some_db_name') takes 10 seconds for some reason, but it does work. weird. vic On Apr 16, 11:09 am, Victor Ng [EMAIL PROTECTED] wrote: Is there a simple example of how to

[sqlalchemy] Re: Stuck creating a custom relation using ActiveMapper

2007-04-16 Thread remi jolin
Hello, Paul Johnston a écrit : Hi, I'm trying to create a relation like this Testing [1] - [many] Target (where target.is_testtgt==0) i.e. I want to map only to Target rows that match the where condition. Now, this is easy enough using assign_mapper: assign_mapper(ctx, Testing,

[sqlalchemy] Re: selecting from M:N via secondary table's column

2007-04-16 Thread Michael Bayer
On Apr 16, 2007, at 5:55 AM, ml wrote: Hi! Let's have: - users_table = Table(users, metadata, Column(id, Integer, primary_key=True), Column(user_name, String(16)) ) addresses_table = Table(addresses, metadata, Column(id, Integer, primary_key=True),

[sqlalchemy] Re: selecting from M:N via secondary table's column

2007-04-16 Thread ml
How can I select user's addresses when I know only his id? And I don't want to select the user first. session.query(Address).join(user).select(User.c.id==the user id) I was afraid of that :-) I hoped it can go in a cleaner way like join(Address.c.user) but giving the property as a

[sqlalchemy] Re: Stuck creating a custom relation using ActiveMapper

2007-04-16 Thread Paul Johnston
Hi, Have you tried : Testing.mapper.add_property('target', relation(Target, primary)) (of course after having defined the Testing and Target classes...) Works a treat! Thank-you, it's great to have this working :-) Paul --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: connecting to ODBC backed by MS-SQL?

2007-04-16 Thread Victor Ng
I'm getting some pretty strange behavior when connecting to SQL Server. My code is pretty straight forward, just create an engine, create metadata, introspect on a table... from sqlalchemy import * db = create_engine('mssql://./msdb') meta = BoundMetaData(db) tbl = Table('sysdtssteplog', meta,

[sqlalchemy] Re: connecting to ODBC backed by MS-SQL?

2007-04-16 Thread Victor Ng
Oops - fingers are faster than my brain. Here's the snippet from the second attempt at creating a Table using autoload, and it succeeds. --- In [10]: tbl = Table('sysdtssteplog', meta, autoload=True) In [11]: [c.name for c in tbl.columns] Out[11]: ['stepexecutionid', 'lineagefull',

[sqlalchemy] Re: connecting to ODBC backed by MS-SQL?

2007-04-16 Thread Rick Morrison
It sounds like its getting to be time to make pyodbc the preferred DBAPI interface for MSSQL. I'll start a new thread to see if there's any objections. On 4/16/07, Victor Ng [EMAIL PROTECTED] wrote: Sweet! This seems to work well now. Is there a way I can update the documentation for the

[sqlalchemy] Proposal: Make pyodbc the preferred DB-API for MSSQL

2007-04-16 Thread Rick Morrison
Unless there's any objections, I think it's time to make pyodbc the preferred access method for MSSQL. Currently the MSSQL module checks for DBAPI interfaces in this order if one isn't specified explicitly: adodbapi pymssql pyodbc I'd like to change it to the exact opposite: pyodbc

[sqlalchemy] create indexes on function

2007-04-16 Thread Steve Huffman
Is it possible to create indexes using a function using sqlalchemy and postgresql? Something like: create index idx on table (lower(table.field)) Thanks, Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Postgres user management and SQLAlchemy

2007-04-16 Thread Koen Bok
I wondered if it was possible to manage users inside postgres with the help of SQLAlchemy. But I guess Postgres users are special objects and not just rows in a table. I tried to do this, but it did not work. from sqlalchemy import * metadata = BoundMetaData('postgres://127.0.0.1/template1')

[sqlalchemy] Re: How to survive a database restart (firebird) ?

2007-04-16 Thread Roger Demetrescu
Thanks Michael, both the 2 approaches did the trick... :) On 4/16/07, Michael Bayer [EMAIL PROTECTED] wrote: with firebird, the appropriate database closed exceptions need to be added to its dialect's is_disconnect() method...someone needs to submit a patch for that (you can create one

[sqlalchemy] Re: Postgres user management and SQLAlchemy

2007-04-16 Thread Michael Bayer
not sure what kind of key error youre getting back, but the issue probably relates either to the lack of a schema argument or improper permissions on one or both tables. On Apr 16, 2007, at 5:24 PM, Koen Bok wrote: I wondered if it was possible to manage users inside postgres with the