[sqlalchemy] setters and getters on an automapped table

2016-08-25 Thread Robert Minsk
I am using automap_base to reflect a table. metadata = MetaData() metadata.reflect(bind=engine, only=['hosts']) automap = automap_base(metadata=metadata) automap.prepare() Hosts = automap.classes.hosts The mac_address column in Hosts is binary and would like to to replace the mac_address with

[sqlalchemy] Checking for an object in the database before adding a potential duplicate

2016-08-25 Thread Kovas Palunas
Hi everyone, I have an database setup where i have two tables/objects that are associated via two many to many relationships (with association tables). I would like to find a way to quickly query for the existence of one of the objects, which is partially defined by its associations with

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Mike Bayer
On 08/25/2016 04:37 PM, Seth P wrote: If I understand what you're saying, the problem is that set _creation_order() specifies an ordering across all columns from all mixins. But shouldn't it suffice to specify the "local" ordering of the columns within a given mixin, and then process the

Re: [sqlalchemy] Re: Get nested query from Exists clause

2016-08-25 Thread Mike Bayer
On 08/25/2016 03:17 PM, Dominik George wrote: To be more precise: I have a query like this one: | session.query(osmalchemy.node).filter(osmalchemy.node.tags.any(key="name",value="Grill-Corner")).all() | It ultimately compiles to this QL expression: | query =SELECT osm_nodes.element_id AS

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Seth P
If I understand what you're saying, the problem is that set _creation_order() specifies an ordering across all columns from all mixins. But shouldn't it suffice to specify the "local" ordering of the columns within a given mixin, and then process the mixins in __mro__ order? (FWIW I worked

Re: [sqlalchemy] Google Bigquery support

2016-08-25 Thread Mike Bayer
On 08/25/2016 11:26 AM, rla...@fastly.com wrote: Hello all, I overrided that method as you suggested, and included placeholders for the other ones being overloaded by calchipan. The reflection functions now work, and I decided to use the same mechanism as calchipan for DDL compilation

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Mike Bayer
the @declarative_attr object would need util.set_creation_order() applied and the _MapperConfig._scan_attributes() would need to take this into account. However, it would not behave well across multiple mixins. The mixins must be scanned in __mro__ order first. So it would be of limited

[sqlalchemy] Re: Get nested query from Exists clause

2016-08-25 Thread Dominik George
To be more precise: I have a query like this one: session.query(osmalchemy.node).filter(osmalchemy.node.tags.any(key="name", value="Grill-Corner")).all() It ultimately compiles to this QL expression: query = SELECT osm_nodes.element_id AS osm_nodes_element_id, osm_elements.element_id AS

Re: [sqlalchemy] Get nested query from Exists clause

2016-08-25 Thread Dominik George
Hi, Am Montag, 15. August 2016 15:32:35 UTC+2 schrieb Mike Bayer: > > > nothing is string-compiled at that point, everything is just nested > inside. the Exists() should have something like "element" inside of it > (look in its __dict__) that is the underlying Selectable. > > > .element is a

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Seth P
I was just bitten by this issue. Is it still the case that there is no way to specify the order of two columns declared in a mixin using @declared_attr? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop

Re: [sqlalchemy] Google Bigquery support

2016-08-25 Thread rlanda
Hello all, I overrided that method as you suggested, and included placeholders for the other ones being overloaded by calchipan. The reflection functions now work, and I decided to use the same mechanism as calchipan for DDL compilation (instantiating a Resolver object that is then passed to

Re: [sqlalchemy] Re: Abusing a string column as list of foreign keys (own relationship class, based on DependencyProcessor?)

2016-08-25 Thread Mike Bayer
On 08/25/2016 07:50 AM, Torsten Landschoff wrote: Hi Mike, On Wednesday, August 24, 2016 at 1:27:42 PM UTC+2, Mike Bayer wrote: if you've already solved the problem I'd rather not get into it :) I am still curious about the inner workins of the DependencyProcessors of sqlalchemy and

Re: [sqlalchemy] Re: Abusing a string column as list of foreign keys (own relationship class, based on DependencyProcessor?)

2016-08-25 Thread Torsten Landschoff
Hi Mike, On Wednesday, August 24, 2016 at 1:27:42 PM UTC+2, Mike Bayer wrote: > if you've already solved the problem I'd rather not get into it :) > > I am still curious about the inner workins of the DependencyProcessors of sqlalchemy and how it would be possible to implement a custom