[sqlalchemy] Re: how to replace selectable but not with original table alias?

2011-10-13 Thread sector119
Thanks a lot, Michael. Really, I can make t = t1 or t = t2 and then use t in select() On 12 Жов, 16:46, Michael Bayer mike...@zzzcomputing.com wrote: replace_selectable can only swap in another selectable that's derived from the original.   Else there's no way to correlate columns between

[sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
I have a SMALLINT column in MSSQL. The value of the column is -2 SQLAlchemy also has the column as SMALLINT but the value is translated as 4294967294 I can't seem to correct this and I haven't found anything on SA and negative numbers. Any help would be really great, thanks. -- You

Re: [sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Michael Bayer
this is something occurring within the DBAPI you're using, i.e. pyodbc, pymssql, etc. you'd need to compose a simple test case using only the DBAPI (else the DBAPI authors will suspect its on SQLAlchemy's side) and report it to them. if a plain DBAPI test does not reproduce the problem, send

Re: [sqlalchemy] Copying one table from one database to the other

2011-10-13 Thread Michael Bayer
On Oct 13, 2011, at 6:38 AM, Eduardo wrote: Hi, I am trying to copy a table (or more of them) from one database to the other. I found somewhere in internet a code snippet that I have slightly modified. I read sequentially rows from the existing table and write them to the new one. The code

[sqlalchemy] How to Query.selecting_from(subquery).join()

2011-10-13 Thread Daniele
What is the proper way to use a subquery as the FROM clause, while being able to use the Query.join() method? Here is an example of what I mean: http://pastebin.com/RUktuZZm The docs at http://www.sqlalchemy.org/docs/orm/query.html#sqlalchemy.orm.query.Query.subquery state: Eager JOIN

Re: [sqlalchemy] How to Query.selecting_from(subquery).join()

2011-10-13 Thread Michael Bayer
hi Daniele - You're in luck because I saw you ask this on IRC yesterday. Using a non-mapped selectable as the thing to select from in Query wasn't supported, but I considered this a bug which has been fixed: http://www.sqlalchemy.org/trac/ticket/2298 If you get the latest tip at

[sqlalchemy] Re: How to Query.selecting_from(subquery).join()

2011-10-13 Thread Daniele
Dear Mr. Bayer, I'm impressed by such a fast response and fix, thank you! On 13 Ott, 16:55, Michael Bayer mike...@zzzcomputing.com wrote: hi Daniele - You're in luck because I saw you ask this on IRC yesterday.  Using a non-mapped selectable as the thing to select from in Query wasn't

[sqlalchemy] DateTimeType

2011-10-13 Thread jn
Using: SQLAlchemy-0.7.2 python_sybase-0.40pre1 Sybase ASE 12.5.3 I have column: edate = Column(DateTime, nullable=False, quote=False) This is info printed using the fetched row: type: type 'DateTimeType' edate: Jan 28 2009 12:00AM edate year: 2009 edate month: 0 Why is the month

Re: [sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
makes sense.. I'm using pydobc. I do the test you suggested.. thanks! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/4XlySuLtQxUJ. To post to this group, send

[sqlalchemy] Re: DateTimeType

2011-10-13 Thread jn
Thanks Mike, you're right it's python-sybase. I'll report the bug. On Oct 13, 2:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 13, 2011, at 4:30 PM, jn wrote: Using: SQLAlchemy-0.7.2 python_sybase-0.40pre1 Sybase ASE 12.5.3 I have column:  edate = Column(DateTime,

[sqlalchemy] passing parameters to subquery in mapped select

2011-10-13 Thread Burak Arslan
hi, is there a way to pass a parameter to a subquery inside a select mapped to a class? the generated query looks like this: select * from ( select distinct on (some_table.id) some_table.id, ... from some_table where some_condition ) as v join ... the outer select is mapped to a class, but

Re: [sqlalchemy] passing parameters to subquery in mapped select

2011-10-13 Thread Michael Bayer
its a little awkward but if you use bindparam() in the inner select, query.params() can access those parameters just fine, you'd just need to use it in all cases. there's some related example of doing this with a relationship at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/GlobalFilter .