[sqlalchemy] Re: adding some sql function to several dialects

2009-03-19 Thread che
): if compiler.dialect.name == 'postgres': return pg_year(%s) % self.value else: return sqlite_year(%s) % self.value year._compiler_dispatch = _compiler_dispatch che wrote: Hi, i need to add several functions to all dialects that i'll plan to use in order to be fully database

[sqlalchemy] adding some sql function to several dialects

2009-03-18 Thread che
Hi, i need to add several functions to all dialects that i'll plan to use in order to be fully database-independent. Does anybody have tips how to achieve this? For example i want to add function year( date) to sqlite and postgres dialects. TIA, Stefan

[sqlalchemy] recursive sql

2009-03-05 Thread che
hi alchemysts, as of end of march 2009 there will be version of PostgreSQL (hopefully, finally;) that will support recursive sqls (WITH RECURSIVE...) and there are also at least 4 other main SQL that already support it (DB2, MSSQL, Firebird, Oracle (syntax diff)), do you have plans for adding

[sqlalchemy] Re: SQL execution order in the unit of work

2007-11-12 Thread che
Hi, On 11 , 04:02, Michael Bayer [EMAIL PROTECTED] wrote: On Nov 10, 2007, at 4:54 PM, Manlio Perillo wrote: Isn't it possible to just use the order used by the programmer? If I call save(A) save(B) the order of save() is signficant for instances of one class: save(A1)

[sqlalchemy] Re: db independent way to get id from sequence

2007-09-24 Thread che
please help --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For

[sqlalchemy] Re: db independent way to get id from sequence

2007-09-24 Thread che
id = connection.execute(Sequence('my_sequence')) thanks, Michael --~--~-~--~~~---~--~~ 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 unsubscribe

[sqlalchemy] db independent way to get id from sequence

2007-09-13 Thread che
Hi, Are there any database independent way to get the id from some sequence - for databases that supports it? For postgres this can be done by issueing select nextval('name_of_the_sequence') statement, but for other databases like oracle, firebird it is maybe different. It seems that there is no

[sqlalchemy] Re: sql executemany and postgresql - probably bug

2007-09-03 Thread che
Hi, this issue (#759) seems fixed with the SA0.4b5. Thanks, Michael. One additional question concerning last_inserted_ids() - is it supposed to work below: ... isql = Insert( table_Manager, values= {'name':bindparam('name'), 'duties':bindparam('duties r2 = con.execute( isql, [

[sqlalchemy] Re: sql executemany and postgresql - probably bug

2007-08-27 Thread che
Thanks Michael, it is not urgent to me. if i found time i'll look down what is causing this and eventually try to patch. regards, stefan On 25 Авг, 03:09, Michael Bayer [EMAIL PROTECTED] wrote: On Aug 23, 2007, at 11:18 AM, che wrote: i cant reply to this issue for another week since im

[sqlalchemy] sql executemany and postgresql - probably bug

2007-08-23 Thread che
Hi, i tried suggested in other thread way of inserting many records into database table and it raised exception against postgres (psycopg2) using the latest trunk (r3412) of SA. Then i checked that in version 0.3.10 same(analogical) code works. Please tell me if there is something wrong with my

[sqlalchemy] Re: sql executemany and postgresql - probably bug

2007-08-23 Thread che
Hi, On 23 Авг, 17:47, Michael Bayer [EMAIL PROTECTED] wrote: dont compile() the insert statement yourself here; since you are only executing it once, theres nothing to be gained by manually compiling first. this was the minimal code demonstrating the issue. i planned to do this many times for

[sqlalchemy] Re: Boolean column in MS SQL

2007-08-02 Thread che
Hi, On 31 Юли, 02:33, Paul Johnston [EMAIL PROTECTED] wrote: Yes, please do. I think you'll find some tweak to MssqlCompiler can achieve this. BTW, AND/OR are not broken generally; I think it's just BIT columns they have a problem with. Paul I dont know how to restrict my changes only

[sqlalchemy] Re: Boolean column in MS SQL

2007-08-02 Thread che
On 2 Авг, 17:00, Michael Bayer [EMAIL PROTECTED] wrote: On Aug 2, 2007, at 5:07 AM, che wrote: you might want to try a. working with the 0.4 trunk, which has a simpler compilation scheme and b. just overriding visit_select() to pass a flag down into sub-visit_XXX calls. also what

[sqlalchemy] Re: Boolean column in MS SQL

2007-07-31 Thread che
On 31 Юли, 02:33, Paul Johnston [EMAIL PROTECTED] wrote: Hi, anyway this seems like bug to me as this will create database- dependence (also AND and OR not working too in MSSQL). i'll try to prepare some general patch to this and send back here (if someone didnot outrun me). Yes, please

[sqlalchemy] Re: Boolean column in MS SQL

2007-07-30 Thread che
Hi, On 27 Юли, 23:27, Paul Johnston [EMAIL PROTECTED] wrote: Hi, type. Do you have some idea how to preserve entire boolean semantics in mssql? I've not tried this but perhaps comparing to 1 does the trick, e.g. instead of a and not b do (a = 1) and not (b = 1) yes, thanks. this works.

[sqlalchemy] Re: MSSQL: using pyODBC

2007-07-04 Thread che
Hi, unfortunately my time-limited trial license of the easysoft driver already expired so i cannot check it further. thanks anyway for your wilingness to help. regards, stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: MSSQL: using pyODBC

2007-06-19 Thread che
hmm it gives with use_scope_identity=False and r2746: File /home/stefanb/src/hor/sqlalchemy/engine/strategies.py, line 106, in create raise TypeError(Invalid argument(s) %s sent to create_engine(), using configuration %s/%s/%s. Please check that the keyword arguments are appropriate for

[sqlalchemy] Re: MSSQL: using pyODBC

2007-06-19 Thread che
shame on me I omit your ...addng the keyword parameter..., i.e. db_mssql = create_engine( 'mssql://sa:[EMAIL PROTECTED] use_scope_identity=1', module= pyodbc) unfortunately with scope identity it crashes earlier - mssql.py returns None for id and rollbacks. best regards stefan

[sqlalchemy] Re: MSSQL: using pyODBC

2007-06-15 Thread che
forgot to mention that SA is at revision r2733. --~--~-~--~~~---~--~~ 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 unsubscribe from this group,

[sqlalchemy] Re: migrate tool

2007-03-20 Thread che
Thanks Evan, Hope that soon I'll use your tool. Stefan --~--~-~--~~~---~--~~ 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 unsubscribe from this

[sqlalchemy] eager load with polymorphic

2007-03-19 Thread che
Hi, I tried to eager load some data from class that have reference to polymorhic class. The object model is: class Base inherited by both Manager and Address, Managers has reference to Address - when I stop here SA can eager loading the addresses of managers. The problem arise when I add another

[sqlalchemy] Re: eager load with polymorphic

2007-03-19 Thread che
Thanks Michael, Michael Bayer написа: On Mar 19, 2007, at 8:29 AM, che wrote: Maybe the problem is that somehow polymorhic and eager cannot be combined? please advice thats correct, in many cases eager loading will degrade to lazy loading, particularly when it detects a self

[sqlalchemy] Re: Explicit column in a SelectResults qry.

2007-03-08 Thread che
Hi, it would be good if SA has similar feature to return scalar, but from the point of view of objects - SA internally knows inheritance and so on ... so one doesnt have to bother of exact tables, but only the object. This can be usefull for reporting on top of SA - see for example if you have

[sqlalchemy] Re: Get error: 'list' object has no attribute 'accept_visitor'

2007-02-20 Thread che
seems the following will do the job: group_columns = [table.c.col1, table.c.col2] select_columns = group_columns + [sqlalchemy.func.sum(table.c.col3), sqlalchemy.func.sum(table.c.col4)] statement = sqlalchemy.select( select_columns, (table.c.col1 == test), group_by=group_columns) res =

[sqlalchemy] Re: SA 0.3.4 and sequence for non-primary key column

2007-02-04 Thread che
thanks again, Michael. Stefan --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to [EMAIL

[sqlalchemy] SA 0.3.4 and sequence for non-primary key column

2007-02-02 Thread che
Hi, I have a table with column that must use sequence generated number (for example in Postgres), like this obj_id: table_Manager = Table( 'Manager', meta, Column( 'obj_id', Integer, Sequence('obj_id_seq'), ), Column( 'duties', type= String, ), Column( 'name', type=

[sqlalchemy] Re: SA 0.3.4 and sequence for non-primary key column

2007-02-02 Thread che
Hi, Michael Bayer написа: if you dont want to use the trunk for now, you can probably define the column as: Column('obj_id', integer, default=func.obj_id_seq.nextval()) this answers another question of mine :) that i planned to ask ...but it generates (on Postgres) this: SELECT

[sqlalchemy] Re: guessing sql joins from object level

2006-12-15 Thread che
Hi, Michael Bayer написа: SA can form joins between tables automatically if the tables express the proper foreign key relationship between each other, and if there is no ambiguity in that relationship; i.e. table A and table B have only one ForeignKeyConstraint (or single ForeignKey)

[sqlalchemy] guessing sql joins from object level

2006-12-08 Thread che
Hi, I am trying to translate to sqlalchemy my queries having on object level clauses like the a.b.c.d == some_value where a is instance of class A, b - instance of class B and... How such queries can be expressed in sqlalchemy code (supposing that every class is mapped to its own table)? Are