Re: [sqlalchemy] alembic questions/comments

2013-05-30 Thread Colleen Ross
What would be great would be to have .sql files and .sqli (mako templates with some context provided by the env.py) in addition to .py files. How hard could that be? ;-) UHHH Alembic *doesn't* support this?! Are you kidding me? Fuckit, I'm sticking to sqlalchemy-migrate. -- You

[sqlalchemy] Simple one-to-one translation with hybrid_attribute

2011-08-01 Thread Ross Vandegrift
, but hybrid_attribute is thinking the DB should do it. Example at the bottom. I don't really understand how to write the @state.expression the way I want things to happen. Thanks, Ross import sqlalchemy as sa import sqlalchemy.orm as orm from sqlalchemy.ext.hybrid import hybrid_property, hybrid_method from

Re: [sqlalchemy] Simple one-to-one translation with hybrid_attribute

2011-08-01 Thread Ross Vandegrift
): return case(self.statenum, statei2a) Exactly what I needed, works like a charm - thank you so much! For the archives - the args are flipped above. Should be case(statei2a, self.statenum). Thanks, Ross signature.asc Description: This is a digitally signed message part

Re: [sqlalchemy] Re: Self-referential, one-to-one, reflexive mappings

2010-08-18 Thread Ross Vandegrift
as the forward reference. Hence why I went with an association object. But since the association object has a relation to both nodes, there not an easy way to know that n1's peer is the OTHER entry in n1.node. Hence why I added the property an synonym. Ross On Aug 18, 4:59 am, Ross Vandegrift r

[sqlalchemy] Self-referential, one-to-one, reflexive mappings

2010-08-17 Thread Ross Vandegrift
, properties={'partners': orm.relation(Person, backref=marriage)}) Ross -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter. If the going gets tough, the songs get tougher. --Woody Guthrie signature.asc Description: Digital signature

[sqlalchemy] polymorphic_on a join leads to incorrect collection

2010-08-11 Thread Ross Vandegrift
? = interface.bindingid 2010-08-11 10:29:42,561 INFO sqlalchemy.engine.base.Engine.0x...60ec [1] Is this a limitation of being polymorphic_on a join instead of mapping the join? Thanks, Ross from sqlalchemy import * import sqlalchemy.orm as orm class Device(object): pass class Switch(Device

[sqlalchemy] ALLCAPS datatypes

2010-06-22 Thread Ross Vandegrift
I wonder this - which am I supposed to use? Ross -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter. If the going gets tough, the songs get tougher. --Woody Guthrie signature.asc Description: Digital signature

Re: [sqlalchemy] Mixed inheritance mapping and multiple binds

2010-01-19 Thread Ross Vandegrift
18, 2010, at 6:27 PM, Ross Vandegrift wrote: engine = create_engine('sqlite:///:memory:', echo=True) metadata.create_all(engine) binds = { device_table : engine, switch_table : engine } Currently its looking at the mapped table of each object's class, which in this case

[sqlalchemy] Mixed inheritance mapping and multiple binds

2010-01-18 Thread Ross Vandegrift
= parent2 child2 = JuniperSwitch() child2.upstream1 = parent1 child2.upstream2 = parent2 session.add_all([r1, r2]) session.add_all([parent1, parent2, child1, child2]) session.commit() -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter. If the going gets tough

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread Ross Vandegrift
. Selectable is the base class for things like select() in SA. This feature is awesome! Rather than specifying your Table object to orm.mapper, specify a Selectable that returns rows that are what you want to see. -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter

[sqlalchemy] Re: ORM lifecycle questions

2008-12-17 Thread Ross Vandegrift
On Thu, Dec 11, 2008 at 02:59:39PM -0500, Michael Bayer wrote: On Dec 11, 2008, at 2:04 PM, Ross Vandegrift wrote: So if I do something like this: p = meta.session.query(model.Pool) pool = p.get(7) meta.session.refresh(pool) InvalidRequestError: Instance 'p...@0xa6aca8c

[sqlalchemy] [PATCH] add MSMediumInteger

2008-08-20 Thread Ross Vandegrift
) + +def get_col_spec(self): +if self.length is not None: +return self._extend(MEDIUMINT(%(length)s) % {'length': self.length}) +else: +return self._extend(MEDIUMINT) + + class MSTinyInteger(MSInteger): MySQL TINYINT type. -- Ross Vandegrift [EMAIL

[sqlalchemy] sqlalchemy 0.4 and multiple database binds

2008-08-18 Thread Ross Vandegrift
gives the incorrect approach. -- Ross Vandegrift [EMAIL PROTECTED] The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man

[sqlalchemy] Re: sqlalchemy 0.4 and multiple database binds

2008-08-18 Thread Ross Vandegrift
On Mon, Aug 18, 2008 at 10:14:44AM -0400, Michael Bayer wrote: On Aug 18, 2008, at 10:07 AM, Ross Vandegrift wrote: Hello everyone, According to the Pylons wiki docs on multiple engines with SQLALchemy 0.4, I should be able to do: def init_model(default_engine, alternate_engine

[sqlalchemy] Re: web application too slow

2008-04-07 Thread Ross Vandegrift
a pretty major performance problem with Mozilla and X11 where render operations on pages with transparent divs are excruciatingly slow on many video cards. The problem is compounded by multiple layers of transparency. In other words - make sure the slowness isn't the client :) -- Ross Vandegrift

[sqlalchemy] Questions on MapperExtension

2008-01-30 Thread Ross
(instance), %str(identitykey))) instance._entity_name = self.entity_name exceptions.AttributeError: 'NoneType' object has no attribute '_entity_name' What did I do wrong? Thanks, Ross [1] http://www.sqlalchemy.org/docs/03/adv_datamapping.html#advdatamapping_extending

[sqlalchemy] Re: Questions on MapperExtension

2008-01-30 Thread Ross
): if not hasattr(instance, 'mutex'): instance.mutex = mutex() return EXT CONTINUE the hasattr() is assuming you dont want to replace the mutex in the case of a session.refresh() or similar. On Jan 30, 2008, at 1:36 PM, Ross wrote: Hello, I