[sqlalchemy] Re: Attribute inheritance problem - IRC comment

2009-07-30 Thread Tomasz Jezierski - Tefnet
Dnia 2009-07-29, Śr o godzinie 11:24 -0400, Michael Bayer pisze: Tefnet Developers wrote: [10:00] jezier stepz_: in for m in mapper.polymorphic_iterator(): you get random order i think While I haven't tested this, based on inspection it should only be random within one level of

[sqlalchemy] Re: More SA, pyodbc, *nux and MSSQL problems

2009-07-30 Thread Ed Singleton
I also forgot to say what the new error I'm getting is. The traceback is below. Some experimentation seems to suggest that the query is getting truncated around the non-ascii char. I have a vague suspicion that it might be related to UCS-2 padding with null chars and some unix programs

[sqlalchemy] rev:6209 in sa06 breaks MSSQL on *nix

2009-07-30 Thread Ed Singleton
Revision 6209 in the sa06 branch breaks everything with MSSQL on Mac and Linux. It's not a major problem as I've reverted back. But I'd thought I'd let you know. Stack trace follows: Traceback (most recent call last): File /Users/singletoned/.envs/nmailer/lib/python2.6/site-packages/

[sqlalchemy] Re: More SA, pyodbc, *nux and MSSQL problems

2009-07-30 Thread Ed Singleton
On 30 Jul 2009, at 04:52, Michael Trier wrote: Hi, On Wed, Jul 29, 2009 at 1:30 PM, Ed Singleton singleto...@gmail.com wrote: Stupidly forgot to attach the files. What I'm trying to achieve is: 1) Ability to insert non-ascii chars into the db on Linux 2) The above but for all

[sqlalchemy] Re: Attribute inheritance problem - IRC comment

2009-07-30 Thread Tomasz Jezierski - Tefnet
Dnia 2009-07-29, Śr o godzinie 11:24 -0400, Michael Bayer pisze: Tefnet Developers wrote: [10:00] jezier stepz_: in for m in mapper.polymorphic_iterator(): you get random order i think While I haven't tested this, based on inspection it should only be random within one level of

[sqlalchemy] AttributeError: 'NoneType' object has no attribute 'dict'

2009-07-30 Thread rajasekhar911
I am using declarative method to map objects. I am getting the following error when i try to create the object My Class is from sqlalchemy.ext.declarative import declarative_base DeclarativeBase = declarative_base() class User(DeclarativeBase): __tablename__='managed_nodes' id =

[sqlalchemy] Executing an SQL script

2009-07-30 Thread guzru
Hello, I have a SQL script that creats some triggers on my DB. I want the script to be executed after all the tables are in place. I wrote this: # Create the tables meta.create_all() # Now create the triggers f = open('sql/triggers.sql','r').read() engine.execute(text(f)) But I

[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'dict'

2009-07-30 Thread Michael Bayer
theres nothing about the given code that should cause any issue (and I tried it on 0.5.1).Upgrade to 0.5.5 in any case and that will almost certainly resolve the issue. rajasekhar911 wrote: I am using declarative method to map objects. I am getting the following error when i try to

[sqlalchemy] Re: More SA, pyodbc, *nux and MSSQL problems

2009-07-30 Thread phrrn...@googlemail.com
The FreeTDS driver needs to be passed a value encoded in the encoding specified in the 'client charset' part of the odbc.ini configuration file for the data-source in question. FreeTDS will use iconv to re- encode the data in UCS-2 (which is either what is used by SQL Server or is equivalent to

[sqlalchemy] Problems with composite primary key and nested relations

2009-07-30 Thread Christian Schwanke
Hi, I've ran into a problem when using a composite primary key with auto_incremented values and nested relations. My scenario is as follows: I have three models A, B and C, where A has a one-to-many relation to B and B has a one-to-many relation to C. A has a standard primarykey consisting of

[sqlalchemy] Re: Fetching wrong values from a query involving composite primary keys

2009-07-30 Thread Michael Bayer
Kirk Strauser wrote: invoices = session.query(Invoice) invoices = invoices.join(BillingInfo) invoices = invoices.join((Customer, BillingInfo.xrscustid==Customer.xrscustid)) invoices = invoices.filter(BillingInfo.typeship=='GBL') invoices = invoices.filter(Invoice.invid==2663703) at this

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-30 Thread Michael Bayer
Christian Schwanke wrote: metadata = MetaData() table_a = Table('table_a', metadata, Column('id', Integer(), primary_key=True), Column('name', String(20), nullable=True), ) table_b = Table('table_b', metadata, Column('a_id', Integer(), nullable=False, primary_key=True),

[sqlalchemy] Re: Fetching wrong values from a query involving composite primary keys

2009-07-30 Thread Kirk Strauser
On Thursday 30 July 2009 12:56:19 pm Michael Bayer wrote: at this point, invoices[0] is the invoice that is subject to the given filter criterion. With you so far. print invoices[0].BillingInfo.typeship now this part is very unusual and is something I haven't tested. Your foreign key

[sqlalchemy] Re: a question about dynamic_loader

2009-07-30 Thread Michael Bayer
Jon Nelson wrote: I have a pair of objects which share a relationship. The relationship is currently defined with dynamic_loader, and is a one:many. One particular use-case is this: objectA.things_of_type_B = list() which appears to work, sorta. When I manipulate objects of type B like

[sqlalchemy] Re: Fetching wrong values from a query involving composite primary keys

2009-07-30 Thread Michael Bayer
Kirk Strauser wrote: But Invoice doesn't have both of those columns. It has a String reference to Customer, while BillingInfo has an Integer reference to Customer [1]. That's why I ended up with the cyclic relation, and wouldn't otherwise need to involve Customer at all. oh, its the

[sqlalchemy] Promoting an object with joined-table inheritance

2009-07-30 Thread Kai Groner
I have several types of user account records. I'm trying to use joined-table inheritance to manage them, but I can't figure out how to create an instance of account type B based on an instance of account type A. I'm using 0.4.8. Is this possible? Is it sane? def experiment_part1(): #

[sqlalchemy] Re: Fetching wrong values from a query involving composite primary keys

2009-07-30 Thread Kirk Strauser
On Thursday 30 July 2009 01:31:21 pm Michael Bayer wrote: oh, its the string. OK so dont do ForeignKeyConstraint, but definitely add to the Invoice.BillingInfo relation() all the information needed within the primaryjoin to select the correct row. seems like it would be (pseudocode)

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-30 Thread Michael Bayer
Im sorry, I misread that ItemC links to ItemB only since I missed the a_id coluimn on B. The issue has to do with MySQLdb's autoincrement not being reported to lastrowid properly (or the autoincrement not firing at all, I dont have time to check right now, but you can experiment by