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

2008-04-02 Thread Lukasz Szybalski
On Wed, Apr 2, 2008 at 6:35 PM, Rick Morrison <[EMAIL PROTECTED]> wrote: > > So how would I find out if this is pyodbc or unixodbc? > > On Unix, it's both. > > pyodbc is the Python DB-API module that provides the DB-API2 interface for > sqlalchemy it in turn relies on an underlying ODBC layer. > >

[sqlalchemy] Re: aliases and joins

2008-04-02 Thread kris
> query.join() is only intended for relations(). To join on tables > directly use query.select_from(table1.join(table2, > onclause)).filter(..)...etc. > > - mike Now that query(TYPE).select_from is deprecated, is there a preferred form? I actually need to something like the follow subquery

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

2008-04-02 Thread Michael Bayer
On Apr 2, 2008, at 7:22 PM, Rick Morrison wrote: > > > hey not to be impolite, but I burned a little oil on this one too, > ya know. > absolutely ! oil burned all around. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: Delayed foreign key resolving

2008-04-02 Thread askel
Michael, Thank you for reply. Of course explicit object loading works well. The only problem is that it actually executes a query, unless master instance is already loaded. This can be avoided by building special INSERT statement during flush(). Something like the following: INSERT into details

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

2008-04-02 Thread Rick Morrison
> So how would I find out if this is pyodbc or unixodbc? On Unix, it's both. pyodbc is the Python DB-API module that provides the DB-API2 interface for sqlalchemy it in turn relies on an underlying ODBC layer. unixodbc is the ODBC-for-Unix implementation that provides an ODBC interface (the ODBC

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

2008-04-02 Thread Lukasz Szybalski
On Wed, Apr 2, 2008 at 6:22 PM, Rick Morrison <[EMAIL PROTECTED]> wrote: > > also of concern is that, nobodys ever going to know they need to use this > parameter when this issue arises. > > Well the idea is that this is a workaround for what I suspect is a broken > Unix + pyodbc configuration, no

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

2008-04-02 Thread Rick Morrison
> also of concern is that, nobodys ever going to know they need to use this parameter when this issue arises. Well the idea is that this is a workaround for what I suspect is a broken Unix + pyodbc configuration, not a long-term solution. its only because I narrowed the issue down to where I knew

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

2008-04-02 Thread Michael Bayer
On Apr 2, 2008, at 7:06 PM, Rick Morrison wrote: > > you can mix both freely. any class that has max_identifier_length > on it, if you set self.max_identifier_length, that overrides it. > > Oh ok, nice. > > Alright, this is in trunk r4429 as a keyword parameter named > "max_identifier_lengt

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

2008-04-02 Thread Lukasz Szybalski
On Wed, Apr 2, 2008 at 6:06 PM, Rick Morrison <[EMAIL PROTECTED]> wrote: > > you can mix both freely. any class that has max_identifier_length on it, > if you set self.max_identifier_length, that overrides it. > > Oh ok, nice. > > Alright, this is in trunk r4429 as a keyword parameter named > "ma

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

2008-04-02 Thread Rick Morrison
> you can mix both freely. any class that has max_identifier_length on it, if you set self.max_identifier_length, that overrides it. Oh ok, nice. Alright, this is in trunk r4429 as a keyword parameter named "max_identifier_length" Lukasz: to use it, add the "max_identifier_length" as a keyword

[sqlalchemy] Re: what = declarative_base

2008-04-02 Thread Bobby Impollonia
I like having the base of my models be .model.Base . That name does a good job of describing what role the class plays; it is the common base on which each model is built. If I were mixing declarative and non-declarative models, then I could understand wanting the declarative ones to be distingui

[sqlalchemy] Re: what = declarative_base

2008-04-02 Thread Michael Bayer
On Apr 2, 2:41 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > It makes me twitch when I see the following: > > Base = declarative_base(metadata=metadata) > > class Spam(Base): > ... > > Base is a singularly undescriptive name to use for the base class of a > declarative table class. Peopl

[sqlalchemy] what = declarative_base

2008-04-02 Thread J. Cliff Dyer
It makes me twitch when I see the following: Base = declarative_base(metadata=metadata) class Spam(Base): ... Base is a singularly undescriptive name to use for the base class of a declarative table class. People are doing this because it's in the documentation. If it were changed there,

[sqlalchemy] Re: Blasted ForeignKey exceptions

2008-04-02 Thread Jim Carroll
> if you want to do it that way without telling SA about the collection > relation between the two entries, it has no way to "guess" what the > foreign key id should be - you'd need to populate the foreign key > identifier explicitly on your log entry: > > session.save(user) > session.flush() > >

[sqlalchemy] Re: aliases and joins

2008-04-02 Thread Michael Bayer
On Apr 2, 2008, at 1:28 PM, Bobby Impollonia wrote: > > Hi. I have a simple model that looks like this: > Base = declarative_base(metadata=metadata) > > class Item(Base): >__tablename__ = 'item' >id = Column('id', Integer, primary_key=True) >group = Column('group', Integer) > > Group

[sqlalchemy] aliases and joins

2008-04-02 Thread Bobby Impollonia
Hi. I have a simple model that looks like this: Base = declarative_base(metadata=metadata) class Item(Base): __tablename__ = 'item' id = Column('id', Integer, primary_key=True) group = Column('group', Integer) Groups have no useful information other than the items they contain, so I

[sqlalchemy] Re: Blasted ForeignKey exceptions

2008-04-02 Thread Michael Bayer
On Apr 2, 2008, at 11:19 AM, Jim Carroll wrote: > I _know_ that the tag with the particular ID is already > in the tags table. > > The first time I had this problem, I had a one-to- > many between just two tables, and I would get this > error if I did a session.save(user) on the user side ( > th

[sqlalchemy] Table column aliases

2008-04-02 Thread Yannick Gingras
Hi, I use Alchemy to connect to a legacy system with horrible table and column names. Here is a snippet to give you an idea: po_details_table = Table('F4311', meta.metadata, Column("PDKCOO", String, primary_key=True), Column("PDDOCO", Integer

[sqlalchemy] ORM as a view

2008-04-02 Thread Yannick Gingras
Hi, I use Alchemy to connection to a legacy system from which I pull data to be inserter into a new system that is being built with Python. I'm only interested by a tiny fraction of the legacy data and I'm wondering if it's possible to specify constraints to the mapper do that Obj.query() wo

[sqlalchemy] Blasted ForeignKey exceptions

2008-04-02 Thread Jim Carroll
MySQL 5.0.38 with InnoDB tables / SQL Alchemy 0.4.4 / Python 2.5.1 Hi, I'm really impressed with SQL Alchemy in general, but now that I'm trying to use it for a large-ish project, I'm getting stuck more often than I'd like. The problem is that when I try to create a record that has foreign keys

[sqlalchemy] Re: "dynamic" Tableclasses

2008-04-02 Thread Lele Gaifax
On Wed, 02 Apr 2008 12:54:59 +0200 robert rottermann <[EMAIL PROTECTED]> wrote: > def __init__(self, pid, **kw): > self.ploneid = pid > self.__dict__.update(kw) > > or do I fool the mapper (or anithing else) with noth explicitely > assining values to all possible fields?

[sqlalchemy] "dynamic" Tableclasses

2008-04-02 Thread robert rottermann
Hi there, I started to work with sqlalchemy. thank you to its creater/contributers. my question: Am I allowed use a Tableclass as the following: class DbNewsItem(object): """a class to connect a plone newsitem with a db news item """ ploneid = '' news = '' def __init_