[sqlalchemy] Re: sqlalchemy migration/schema creation

2008-04-17 Thread az
On Thursday 17 April 2008 00:07:28 Lukasz Szybalski wrote: On Wed, Apr 16, 2008 at 1:03 AM, [EMAIL PROTECTED] wrote: a separate feature - no. but it's not much to do it. here my attempt at this. try copyall or copydata+autoload from here: svn co

[sqlalchemy] To select a tree with PG connectby() in a single request

2008-04-17 Thread jean-philippe dutreve
Hi all, I'm trying to load a whole Tree of Account objects (Mapped instances) in a single SELECT with unlimited depth. I'm using PostgreSQL connectby function from the tablefunc module. It returns rows of each nodes in a depth first visit. sql = SELECT acc_accounts.* FROM

[sqlalchemy] Sqlautocode error

2008-04-17 Thread Vortexmind
Hi I'm trying to use this Sqlalchemy exstension ( http://code.google.com/p/sqlautocode/ ) to auto import a model from a legacy database. While I tried runtime reflection, I was thinking to avoid it to have a static defined model. I found this tool to automate this, but it gives me an error and I

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Mon, Apr 7, 2008 at 4:37 PM, Rick Morrison [EMAIL PROTECTED] wrote: The limitation here I guess is 30 char identifier limit but I will need to test it. Ah yeah, you're going to have bigger problems than 30 char identifiers with the Sybase TDS settings. MSSQL uses a different set of

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Thu, Apr 17, 2008 at 10:02 AM, Lukasz Szybalski [EMAIL PROTECTED] wrote: On Mon, Apr 7, 2008 at 4:37 PM, Rick Morrison [EMAIL PROTECTED] wrote: The limitation here I guess is 30 char identifier limit but I will need to test it. Ah yeah, you're going to have bigger problems

[sqlalchemy] Re: sqlalchemy migration/schema creation

2008-04-17 Thread az
On Thursday 17 April 2008 18:27:22 Lukasz Szybalski wrote: On Thu, Apr 17, 2008 at 3:51 AM, [EMAIL PROTECTED] wrote: On Thursday 17 April 2008 00:07:28 Lukasz Szybalski wrote: On Wed, Apr 16, 2008 at 1:03 AM, [EMAIL PROTECTED] wrote: a separate feature - no. but it's not

[sqlalchemy] Re: Sqlautocode error

2008-04-17 Thread az
u may also look at svn co http://dbcook.svn.sourceforge.net/dbcook/trunk/dbcook/misc/metadata/ run autoload.py dburl YMMV On Thursday 17 April 2008 17:40:02 Vortexmind wrote: Hi I'm trying to use this Sqlalchemy exstension ( http://code.google.com/p/sqlautocode/ ) to auto import a model

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Rick Morrison
Here are the options as specified by free TDS. What you are talking about is setting it in conf file which is used only for dsn connection. No, I meant as the *default* TDS version here. See here: http://www.freetds.org/userguide/freetdsconf.htm I'm talking about the [global] setting,

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Thu, Apr 17, 2008 at 12:14 PM, Rick Morrison [EMAIL PROTECTED] wrote: Here are the options as specified by free TDS. What you are talking about is setting it in conf file which is used only for dsn connection. No, I meant as the *default* TDS version here. See here:

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Rick Morrison
ok, ok, assuming that dsn-less connections actually do ignore the .conf file and require all that stuff to be specified. here's the question that I'm trying to ask: instead of something like this: create_engine('mssql://user:[EMAIL PROTECTED]/database', odbc_driver='TDS',

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Rick Morrison
It's in trunk r4518. Take 'er for a spin and let me know how it works out. On Thu, Apr 17, 2008 at 2:54 PM, Lukasz Szybalski [EMAIL PROTECTED] wrote: On Thu, Apr 17, 2008 at 1:22 PM, Rick Morrison [EMAIL PROTECTED] wrote: ok, ok, assuming that dsn-less connections actually do ignore the

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Thu, Apr 17, 2008 at 2:07 PM, Rick Morrison [EMAIL PROTECTED] wrote: It's in trunk r4518. Take 'er for a spin and let me know how it works out. got an error: e = sqlalchemy.create_engine('mssql://xxx:[EMAIL PROTECTED]:1433/',odbc_options='DRIVER={TDS};TDS_Version=8.0') Traceback (most

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Rick Morrison
Does it matter what case are the parameters? DRIVER in pyodbc, we used 'driver' in previous connection strings etc... No the parameters are a straight pass-through, that traceback is complaining about the 'odbc_options' keyword itself. Are you sure you're running the current trunk?

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Thu, Apr 17, 2008 at 2:35 PM, Rick Morrison [EMAIL PROTECTED] wrote: Does it matter what case are the parameters? DRIVER in pyodbc, we used 'driver' in previous connection strings etc... No the parameters are a straight pass-through, that traceback is complaining about the

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Rick Morrison
It's a two-line change that pops the new keyword out of the config dict just like the others that were added. Mike, can you take a quick look at mssql.py line 804 and see why this might be complaining? I've got to run out. On Thu, Apr 17, 2008 at 3:58 PM, Lukasz Szybalski [EMAIL PROTECTED]

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-17 Thread Lukasz Szybalski
On Thu, Apr 17, 2008 at 3:04 PM, Rick Morrison [EMAIL PROTECTED] wrote: It's a two-line change that pops the new keyword out of the config dict just like the others that were added. Mike, can you take a quick look at mssql.py line 804 and see why this might be complaining? I've got to run

[sqlalchemy] Re: Get Mapper for Table

2008-04-17 Thread Koen Bok
Got it, thanks! On Apr 16, 4:26 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 16, 2008, at 10:13 AM, Koen Bok wrote: Hey all, Before 0.4.5 I used this code to get the mapped class for a table. It worked fine, but mapper_registry was made private in 0.4.5 and the private function

[sqlalchemy] Re: To select a tree with PG connectby() in a single request

2008-04-17 Thread jean-philippe dutreve
Thank you for the suggestion but the extension method doesn't fired, even without raw sql: mapper(Account, table_accounts, extension=AccountLoader(), properties=dict( children = relation(Account, lazy=None, primaryjoin=table_accounts.c.parent_id==table_accounts.c.account_id,

[sqlalchemy] Re: To select a tree with PG connectby() in a single request

2008-04-17 Thread Michael Bayer
On Apr 17, 2008, at 5:51 PM, jean-philippe dutreve wrote: class AccountLoader(MapperExtension): def append_result(self, mapper, selectcontext, row, instance, result, **flags): isnew = flags.get('isnew', False) if instance.parent_id is None:

[sqlalchemy] subquery and inheritance

2008-04-17 Thread kris
I have several tables derived from a base base = Table ('base', ..., Column ('id'), Integer, primarykey=True)) d1= Table ('derived1', Column ('id', Integer, ForignKey('base.id' ), primarykey=True) Column ('parent_id', Integer, ForignKey('base.id' ))