[sqlalchemy] Differentiate ANSIIdentifierPreparer.format_column select clause from where clause??

2007-02-16 Thread Troy
Is there a way in the format_column method of ANSIIdentifierPreparer to determine if the column is part of the select clause, where clause, order clause, etc? What I'm attempting to do is override the default postgres dialect to format string columns as 'lower(colname)' only when the column is

[sqlalchemy] SA skips integrity referential?

2007-02-16 Thread Jose Soares
Hi all, I wonder how SA could delete a row of my table (postgresql) linked with another table. Take a look... pg= select * from attivita where cod_specie='33'; codice | descrizione | cod_specie

[sqlalchemy] postgres, autoload, and odd datatypes

2007-02-16 Thread x
I found the discussion last month regarding the lack of support for specialised datatypes in the postgres reflection code. I have a lot of odd datatypes in my schemas... besides inet, there's postgis datatypes and tsearch2's tsvector, etc. However, most of these odd fields are never manipulated

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Gary Bernhardt
Referential integrity isn't being violated here - SA is nulling the foreign key before deleting the row it points to. Try adding nullable=False to the declaration of attivita.cod_specie. That should make it fail in the way you expect, because SA will no longer be able to null the foreign key.

[sqlalchemy] eager loading and nested property

2007-02-16 Thread Manlio Perillo
Hi. I have a mapper A, with some property eager loaded. When I query A, I can use the options method to remove some property from being loaded (with noload). I have now a mapper B, with a property of type A eager loaded. When I query B, A, and all its property are eager loaded and it seems that

[sqlalchemy] Re: Reflection including Relations

2007-02-16 Thread shday
Foreign key relations *are* reflected. That information is used when you set-up 'properties'. Notice that you don't have to specify any keys when you define properties. SA just doesn't do the 'properties' automatically (by design I think). Steve On Feb 16, 12:14 pm, Andreas Jung [EMAIL

[sqlalchemy] Function preface

2007-02-16 Thread Rick Morrison
I want to write a function for each of the databases our product supports and call them in the same way for all databases. This works with most databases, but MS-SQL Server does something different and forces the function to be called with an owner specifier, so what would be simply myfunc()

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Gary Bernhardt wrote: Referential integrity isn't being violated here - SA is nulling the foreign key before deleting the row it points to. Try adding nullable=False to the declaration of attivita.cod_specie. That should make it fail in the way you expect, because SA will no longer be

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Jonathan Ellis
On 2/16/07, jose [EMAIL PROTECTED] wrote: Gary Bernhardt wrote: Referential integrity isn't being violated here - SA is nulling the foreign key before deleting the row it points to. Try adding nullable=False to the declaration of attivita.cod_specie. That should make it fail in the

[sqlalchemy] Re: postgres, autoload, and odd datatypes

2007-02-16 Thread Jonathan Ellis
I'd prefer to not have them loaded at all (maybe with log.warning) than to have them loaded with a known-to-be-incorrect type. If you really don't want to manipulate them from Python, not loading them is the Right Thing. If you do want to manipulate them then the Right Thing is to add the

[sqlalchemy] Re: Reflection including Relations

2007-02-16 Thread Jonathan Ellis
You say defined manually... automatically. It can't be both. :) SA won't try to guess what properties you want on your mapped classes, because it could guess wrong. (Believe me, whatever pattern you are thinking of, someone could find an exception where automatically setting it up is not the

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Jonathan Ellis wrote: On 2/16/07, jose [EMAIL PROTECTED] wrote: Gary Bernhardt wrote: Referential integrity isn't being violated here - SA is nulling the foreign key before deleting the row it points to. Try adding nullable=False to the declaration of attivita.cod_specie. That

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Jonathan Ellis
On 2/16/07, jose [EMAIL PROTECTED] wrote: Jonathan Ellis wrote: Guess it would surprise you to learn about the SQL 92 ON DELETE SET NULL functionality too. :) Seems to me the SQL92 'ON DELETE SET NULL' is an explicit functionality, instead in our case, SA does this functionality in

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Jonathan Ellis wrote: On 2/16/07, jose [EMAIL PROTECTED] wrote: Jonathan Ellis wrote: Guess it would surprise you to learn about the SQL 92 ON DELETE SET NULL functionality too. :) Seems to me the SQL92 'ON DELETE SET NULL' is an explicit functionality, instead in our

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Jonathan Ellis
If you want to do things the hard way, you can do this by turning off cascade on the relationship (cascade='none'). But you can't have your cake and eat it too, you'll have to manually handle adding new subordinate objects to the session when saving, etc. On 2/16/07, jose [EMAIL PROTECTED]

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
jose wrote: Jonathan Ellis wrote: On 2/16/07, jose [EMAIL PROTECTED] wrote: Jonathan Ellis wrote: Guess it would surprise you to learn about the SQL 92 ON DELETE SET NULL functionality too. :) Seems to me the SQL92 'ON DELETE SET NULL' is an

[sqlalchemy] Re: Differentiate ANSIIdentifierPreparer.format_column select clause from where clause??

2007-02-16 Thread Michael Bayer
On Feb 16, 2007, at 3:18 AM, Troy wrote: Is there a way in the format_column method of ANSIIdentifierPreparer to determine if the column is part of the select clause, where clause, order clause, etc? What I'm attempting to do is override the default postgres dialect to format string

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Michael Bayer
On Feb 16, 2007, at 3:46 PM, jose wrote: No Jonathan, I don't want this column is set as NOT NULL, I have to allow null values for this column and I don't want enable the ON DELETE SET NULL functionality. I would like SA have the same behavior as PostgreSQL has, I like the message: pg

[sqlalchemy] Re: Function preface

2007-02-16 Thread Michael Bayer
id want the MS-SQL dialect to add the dbo in its own visit_function () code when it generates the SQL. this would require the dialect knows an MS-SQL builtin from a user-defined. the reason we dont do it in the func itself is because the SQL constructs themselves remain database-agnostic

[sqlalchemy] Re: eager loading and nested property

2007-02-16 Thread Michael Bayer
On Feb 16, 2007, at 12:19 PM, Manlio Perillo wrote: Hi. I have a mapper A, with some property eager loaded. When I query A, I can use the options method to remove some property from being loaded (with noload). I have now a mapper B, with a property of type A eager loaded. When I query

[sqlalchemy] Re: Bug with unicode database paths on win32

2007-02-16 Thread Michael Bayer
uh yeah definitely...create_engine takes the str or unicode so the BoundMetaData should as well...rev 2325. On Feb 16, 2007, at 12:41 PM, Evandro Miquelito wrote: Hello! First of all I would like to congratulate SQLAlchemy developers for this amazing toolkit. I have been worked with

[sqlalchemy] Re: postgres, autoload, and odd datatypes

2007-02-16 Thread Michael Bayer
OK, i propose we make the KeyError more friendly, and add an option skip_unknown_types to Table to indicate just to skip the columns. if we really want the default fallback type, id prefer an option for that too, like default_type=sometype and it will shove that type in for the unknown

[sqlalchemy] Re: Function preface

2007-02-16 Thread Rick Morrison
Thinking about this a bit more, it seems to me that this may be a useful construct in its own right. Take the example where a user want to call a function that was declared in a different schema than the base tables that it is going to operate on. This is sometimes the case when there is a

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Michael Bayer wrote: On Feb 16, 2007, at 3:46 PM, jose wrote: No Jonathan, I don't want this column is set as NOT NULL, I have to allow null values for this column and I don't want enable the ON DELETE SET NULL functionality. I would like SA have the same behavior as PostgreSQL has, I like