[sqlalchemy] how to make unique constrain within ORM

2009-08-28 Thread vkuznet
Hi, I created ORM classes and can't find out a way to make an UniqueConstraint for two columns. Do we have an example elsewhere? When I used UniqueConstraint from sqlachemy.schema inside of ORM class it does nothing, so it's not defined in a table. In particular here is my class class

[sqlalchemy] Re: how to specify owner.table.column

2008-03-25 Thread vkuznet
Great, I was just wondering. But glad to see confirmation. Yes we do have a use case when the same tablenames cause weird behavior in ORACLE. Below is a message from our DBA in response to hick-up when we occasionally got: ORA-00942: table or view does not exist error. Valentin.

[sqlalchemy] Re: using limit w/ distinct on ORACLE (revise bug #536)

2008-03-25 Thread vkuznet
Ok, here is an example in ORACLE. Table schema (for simplicity I removed unnecessary columns): CREATE TABLE Block ( IDinteger, Name varchar(500) unique not null, Path varchar(500) not null, primary key(ID) ); So

[sqlalchemy] Re: using limit w/ distinct on ORACLE (revise bug #536)

2008-03-25 Thread vkuznet
Yes this works too. So you'll accept/fix the bug :)? Thanks a lot Valentin. --~--~-~--~~~---~--~~ 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

[sqlalchemy] query on stdout

2008-03-28 Thread vkuznet
Hi, I just noticed that both 0.3.x and 0.4.x versions of SQLAlchemy print compiled query for MySQL without binded parameters, so typical printout for MySQL looks like SELECT DISTINCT block.`Path` AS `block_Path` FROM tier0.block WHERE block.`Path` LIKE %s while doing the same with ORACLE

[sqlalchemy] method to retrieve selectable columns

2008-05-21 Thread vkuznet
Hi, is there any way to ask select object what is suppose to select? There is a method locate_all_froms which return FROM part of select, but I'm interesting in select part of SQL statement. So, something like: s = select([table1.c.a,table2.c.b]) listOfSelectedColumns =

[sqlalchemy] Re: method to retrieve selectable columns

2008-05-21 Thread vkuznet
has a dictionary interface. On May 21, 2008, at 12:01 PM, vkuznet wrote: Hi, is there any way to ask select object what is suppose to select? There is a method locate_all_froms which return FROM part of select, but I'm interesting in select part of SQL statement. So, something like

[sqlalchemy] loading tables is very slow

2008-08-27 Thread vkuznet
Hi, I've been trying to profile why loading a single table from remote ORACLE DB takes more then 5 seconds. Here is some numbers: create engine 0.0740728378296 engine.connect 2.05604815483 SELECT table_name FROM all_tables WHERE owner='ZZZ' get tables 0.18466091156 Loading

[sqlalchemy] Re: loading tables is very slow

2008-08-28 Thread vkuznet
grained to indicate where the   time is being spent, and if it were within SA reflection code then   these kinds of speed issues would be apparent across all dialects.   Can you post some profile results for your tests ? On Aug 27, 2008, at 3:57 PM, vkuznet wrote: Hi, I've been trying

[sqlalchemy] Re: arbitrary join/select from a given list

2007-02-05 Thread vkuznet
, Michael Bayer [EMAIL PROTECTED] wrote: select([x.c.col1, y.c.col2, z.c.col3, ...], from_obj=[x.join(y).join(z).join(q)...]) On Feb 5, 2:27 pm, vkuznet [EMAIL PROTECTED] wrote: Hi, I've trying to solve the following problem. I've given a list of tables and list of columns to look at. All

[sqlalchemy] cross DB development, columns lower/upper case letters

2007-02-12 Thread vkuznet
Hi, I'm trying to develop a cross-DB application which works with ORACLE and MySQL back-ends. Both DBs has the same schema, but of course there is a caveat. ORACLE has Tables and Columns in upper case and MySQL does not. That leads to the following problem. When I construct select(table.c.column)

[sqlalchemy] how to get column names in result

2007-02-24 Thread vkuznet
Hi, a very simple question which I cannot find in documentation. How to get column names together with result. This is useful for web presentation of results using templates. I used use_labels=True, indeed it construct query with names, but my final result contains only column values. What I

[sqlalchemy] connection pool

2007-03-14 Thread vkuznet
Hi, I just came across Documentation and it's not clear to me how to use connection pooling. When invoked db=create_engine() the pool parameter is set to None by default, right? In Connection pooling section of docs, it's said For most cases, explicit access to the pool module is not required

[sqlalchemy] Re: connection pool

2007-03-14 Thread vkuznet
Hi, it's not obvious, nothing said in a docs about default pool setup and The Database options section has: pool=None - an actual pool instance. that's why I conclude that pool is NOT setup by default. I just want to confirm that. Valentin. On Mar 14, 1:34 pm, Sébastien LELONG [EMAIL PROTECTED]

[sqlalchemy] table name/Foreign key

2007-03-20 Thread vkuznet
Hi, I have a dump question about naming conventions for foreign keys. Using ORACLE as back-end all table names are in capital letters. So Table object looks like: Table('BRANCH',DynamicMetaData(),Column('id',OracleInteger(),primary_key=True,nullable=False),

[sqlalchemy] Re: how to display all the tables of my DB

2007-03-23 Thread vkuznet
Hi, I've used slightly different approach: sel=SELECT table_name FROM all_tables WHERE owner='XXX' # ORACLE sel=show tables # MySQL sel=SELECT name FROM SQLITE_MASTER WHERE type='table' # SQLite con=dbengine.connect() metadata=DynamicMetaData() tList = con.execute(sel)

[sqlalchemy] Re: ORACLE db name in table definitions

2007-03-23 Thread vkuznet
Thanks, it works. On Mar 23, 10:56 am, Michael Bayer [EMAIL PROTECTED] wrote: dont stick foo.bar in your table name. use the schema=DBNAME parameter on your Table. On Mar 23, 2007, at 9:41 AM, vkuznet wrote: Hi, I've got a new DB to handle and the account is setup in a way that I

[sqlalchemy] adding joins to existing select

2007-04-06 Thread vkuznet
Hi, is there are any way to add additional joins to a given select object? My problem is the following, I need to join the same table multiple times. How many times I don't know in advance and in addition I need to apply where clause while adding this join. Thanks, Valentin.

[sqlalchemy] count and distinct

2007-04-13 Thread vkuznet
Hi, I found that if I do select([func.count(table.c.column)],distinct=True).execute() the resulting query is select distinct count(column) from table but it's not what I wanted. If my column has duplicates you got counting them, rather then count unique names. The proper SQL query would be

[sqlalchemy] weird ORACLE behaviour with limit/offset

2007-04-13 Thread vkuznet
Hi, I added to my query the limit and offset (using ORACLE). To my surprise results ARE varying if I'll print my select or not before executing query. What I mean is the following sel = select () #print sel sel.execute() so, if I will not print my select, I'll get *smaller* number of

[sqlalchemy] Re: AS for Oracle

2007-04-14 Thread vkuznet
), 'name)': (NullTypeEngine(), 0)}, 'columns': {'name': Column('name',OracleString(length=500),nullable=False)}} Any ideas, what's wrong? Valentin. On Apr 14, 5:25 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 14, 2007, at 3:14 PM, vkuznet wrote: Hi, I'm trying to debug what's going

[sqlalchemy] Re: AS for Oracle

2007-04-14 Thread vkuznet
Sorry for spam, it's a bug in my program. Thanks for your support and prompt responses. Valentin. On Apr 14, 8:46 pm, vkuznet [EMAIL PROTECTED] wrote: Thank you Mike, but I'm out of ideas with my problem, the resulting query return non- zero result in sqlplus prompt, but SQLAlchemy return

[sqlalchemy] how to add whereclause string

2007-04-19 Thread vkuznet
Hi, I'm developing a web application where users are allowed to specify where statement. So I can capture it as a string, e.g. ( T1.C1=1 OR T1.C1=5) AND T3.C3 like 'test%' where T1 is table 1 and C1 is column 1, and so on. Now the hard question is how to add such string to sqlalchemy query? I've

[sqlalchemy] Re: how to add whereclause string

2007-04-19 Thread vkuznet
it to underneath query, so whereclause validation is in place. Thanks for reference. Valentin. On Apr 19, 1:20 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 19, 2007, at 12:37 PM, vkuznet wrote: Hi, I'm developing a web application where users are allowed to specify where statement. So I can