[sqlalchemy] Re: in-place modification of queries?

2015-12-28 Thread Lloyd Kvam
just assign to the same variable name. query = guery.filter(Foo.x == 1) The generative queries are a feature. Making the queries mutable would allow functions to modify queries and complicate debugging. You can have functions return the modified query, or have functions return the expressions

[sqlalchemy] Re: Bulk update when using .execute() with multiple parameters?

2014-09-05 Thread Lloyd Kvam
You really want to test this yourself on YOUR setup. I know my code is sending a single execute for this scenario, but I'm not hitting any speed bumps. Set echo to True and see what happens. (a_table.metadata.bind.echo = True). Then set it back to False. You can change echo on the fly.

Re: [sqlalchemy] How Can I Build a ForeignKey to a Table Which Has Multiple Primary Keys?

2013-03-07 Thread Lloyd Kvam
While primary_key is specified twice, once for each column, there is only ONE primary key which is a composite. You need to use ForeignKeyConstraint at the Table level to specify a composite foreign key. You need to provide two lists, the local table columns, and the corresponding foreign

[sqlalchemy] Re: sanitizing sql with sqlalchemy

2013-01-01 Thread Lloyd Kvam
I should probably remove my fingers from the keyboard since I have so little experience with mssql, but here goes: Isn't the . only special in field and table names? If that's where the user input was used, I think it's the programmer's responsibility to validate/sanitize the input. A plugin

[sqlalchemy] Making ResultProxy test as False when there are no rows

2011-10-14 Thread Lloyd Kvam
Would it make sense to add a __nonzero__ method to ResultProxy that was tied to the rowcount? def __nonzero__(self): return bool(self.rowcount) This would allow code like if results: process(results) I was surprised when this did not work. -- You received this message because you are

[sqlalchemy] Re: Making ResultProxy test as False when there are no rows

2011-10-14 Thread Lloyd Kvam
On Oct 14, 11:02 am, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 14, 2011, at 10:38 AM, Lloyd Kvam wrote: Would it make sense to add a __nonzero__ method to ResultProxy that was tied to the rowcount? def __nonzero__(self):    return bool(self.rowcount) This would allow

[sqlalchemy] Re: Using multiple databases for reliability (NOT sharding)

2010-12-17 Thread Lloyd Kvam
On Dec 17, 1:21 pm, Michael Bayer mike...@zzzcomputing.com wrote: Doesn't seem like anyone has any thoughts here.   Its certainly not something I've tried, but the general area of study here is multi-master replication:  http://en.wikipedia.org/wiki/Multi-master_replication.   The various

[sqlalchemy] Re: Using multiple databases for reliability (NOT sharding)

2010-12-17 Thread Lloyd Kvam
(Sorry, I mis-clicked before.) I've used MySQL replication for sharing data from multiple databases. You can organize the servers in a loop and configure them to pass along the changes replicated by other servers. Of course if any server fails, the loop is broken until that server is running

[sqlalchemy] Re: Error - class 'sqlalchemy.exc.OperationalError': (OperationalError) (2006, 'MySQL server has gone away')

2010-10-14 Thread Lloyd Kvam
On Oct 14, 5:48 pm, Timmy Chan timmy.cha...@gmail.com wrote: sorry if this is addressed, but i'm running apache2 SQLAlchemy 0.5.8 Pylons 1.0 Python 2.5.2 and on a simple page (just retrieve data from DB), I get: Error - class 'sqlalchemy.exc.OperationalError': (OperationalError) (2006,

[sqlalchemy] reflecting (autoload=True) MySQL tinyint(1) fields

2010-03-27 Thread Lloyd Kvam
I've just discovered that some tinyint (8-bit) fields have had their values limited to 0 and 1 regardless of actual value supplied. Digging through the documentation, I've learned that when MySQL tables are reflected, tinyint(1) fields are processed as booleans. I did not find emails from others

[sqlalchemy] Re: insert() on compound key-how to auto number second key

2007-09-08 Thread Lloyd Kvam
a fairly straight-forward way to have parallel independent remote databases (think retail stores) and a central database. -- Lloyd Kvam Venix Corp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group