Re: [sqlalchemy] adding joins to existing select

2013-10-16 Thread tiadobatima
Hello there... however, if you want to chain the joins themselves together, you probably want to construct the Join object ahead of time I was looking for examples on how to do this but I couldn't find it. I tried a few variations of this: # tbl_a, tbl_b, and tbl_c are Table

[sqlalchemy] Rewriting input/output values on columns with core

2013-10-07 Thread tiadobatima
Hello there, I see that Column() has default, onupdate, and server_default to be used when the value for that column is not present when inserting and updating... What would be the best way of rewriting a value that is present when inserting or updating? Similarly, is there any easy way of

[sqlalchemy] How to find the local column name given a ForeignKey object?

2013-10-03 Thread tiadobatima
Hello there, I'm wondering if there is an easy way of finding the local column name given a ForeignKey. For example, the snippet below just gives me the remote column name: for fkey in meta.tables['mytable'].foreign_keys: print fkey.column I understand I could iterate over all the columns

Re: [sqlalchemy] How to find the local column name given a ForeignKey object?

2013-10-03 Thread tiadobatima
Great! Exactly what I was looking for :) Thank you very much! g. On Thursday, 3 October 2013 14:02:58 UTC-7, Michael Bayer wrote: ForeignKey has .column as the column it refers to, and .parent as the column that is constrained to that .column. On Oct 3, 2013, at 3:18 PM, tiadobatima gbar

Re: [sqlalchemy] Mocking RowProxy and ResultProxy objects

2013-07-31 Thread tiadobatima
Great! I'm gonna check it out :) Thanks! On Saturday, 27 July 2013 12:11:12 UTC-7, Michael Bayer wrote: take a look in test/engine/test_pool and test/engine/test_reconnect for examples On Jul 27, 2013, at 1:50 PM, tiadobatima gbar...@gmail.com javascript: wrote: Hi Michael, Yeah

[sqlalchemy] Extending sqlalchemy.schema.Table

2013-07-31 Thread tiadobatima
Hello there, When this application starts, we reflect the DB into a MetaData() object and this is made available for everyone to use. I'd like to add a few more methods to the table objects within that MetaData(). Is there any easy way to extend these already instantiated

Re: [sqlalchemy] Mocking RowProxy and ResultProxy objects

2013-07-27 Thread tiadobatima
UTC-7, Michael Bayer wrote: have you tried the mock library?I'm using it quite a bit now and have mocked things like engines and connections. Should be pretty easy to make it act like a result object. On Jul 24, 2013, at 8:37 PM, tiadobatima gbar...@gmail.com javascript: wrote

[sqlalchemy] Mocking RowProxy and ResultProxy objects

2013-07-26 Thread tiadobatima
Hello there, I''ve extended both RowProxy and ResultProxy, and I'm trying to figure out a way to mock objects of these classes in order to write some unit tests. I was looking at the SQLAlchemy's unittests and I'm still not sure how to do this without using a real database. Google hasn't been