Re: [sqlalchemy] Is it possible to have a relationship to denormalized fileds in the same row?

2018-02-18 Thread Andrew Pashkin
t; > http://docs.sqlalchemy.org/en/latest/orm/composites.html > > > On Feb 18, 2018 4:25 PM, "Andrew Pashkin" <andrew@gmx.co.uk > > wrote: > >> I wonder if it's possible to have a field in a declarative model that >> would have relationship semantics but at the

Re: [sqlalchemy] Is it possible to have a relationship to denormalized fileds in the same row?

2018-02-18 Thread Andrew Pashkin
That's great, thanks! On Monday, February 19, 2018 at 1:03:07 AM UTC+3, Mike Bayer wrote: > > This would be a composite: > > http://docs.sqlalchemy.org/en/latest/orm/composites.html > > > On Feb 18, 2018 4:25 PM, "Andrew Pashkin" <andrew@gmx.co.uk > &g

[sqlalchemy] Is it possible to have a relationship to denormalized fileds in the same row?

2018-02-18 Thread Andrew Pashkin
I wonder if it's possible to have a field in a declarative model that would have relationship semantics but at the same time would be linked to a set of columns from the same row as the parent object and load the relationship without an additional join? -- SQLAlchemy - The Python SQL Toolkit

Re: [sqlalchemy] Can't define __table_args__ on a child-class in a single-table inheritance setup

2017-05-08 Thread Andrew Pashkin
Awesome, thank you for the response, this is what I was looking for. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See

[sqlalchemy] Can't define __table_args__ on a child-class in a single-table inheritance setup

2017-05-07 Thread Andrew Pashkin
I've found that if __table_args__ is present on a child class in a single-table inheritance setup , SQLAlchemy throws sqlalchemy.exc.ArgumentError: Can't place __table_args__ on an inherited class with no

[sqlalchemy] How to make assignments work backwards as well in examples.generic_associations.discriminator_on_association example?

2017-04-15 Thread Andrew Pashkin
appreciate any input on that. -- With kind regards, Andrew Pashkin. cell phone - +375 (44) 492-16-85 Skype - waves_in_fluids e-mail - andrew.pash...@gmx.co.uk -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCV

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-07-21 Thread Andrew Pashkin
I think, that in case of Select, Select.froms can be used from retrieving tables. But what what to know is if it's ordered too? -- You received this message because you are

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-07-21 Thread Andrew Pashkin
On 07/21/2016 05:13 PM, Mike Bayer wrote: Are entities in column_descriptions ordered? yes In what order? Is there something similar for SA SQL expressions? select.c How to retrieve an entity from select.c, which is suitable for putting it in select.order_by? -- You received this

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-07-21 Thread Andrew Pashkin
On 07/15/2016 04:14 PM, Mike Bayer wrote: I wasn't sure what the question was here. To get the first ORM entity, use column_descriptions: query = query.order_by(query.column_descriptions[0]["entity"].name) Are entities in column_descriptions ordered? Is there something similar for SA SQL

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-07-15 Thread Andrew Pashkin
Bump. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com.

Re: [sqlalchemy] Calculated relationships

2016-06-03 Thread Andrew Pashkin
Bump -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com.

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-05-26 Thread Andrew Pashkin
On 05/25/2016 11:16 PM, Mike Bayer wrote: Assuming you want more, phrase this as an input/output situation for me. Give me input and what the desired output you want is. The big guns here are a function called corresponding_column() which I can show you how to use if that's what's needed

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-05-25 Thread Andrew Pashkin
On 05/25/2016 09:28 PM, Mike Bayer wrote: why do you even need this? Basically I have a REST API for which I want to add functionality of filtering and sorting, according to user provided parameters. User supposed to provide a field name and the magic function should resolve this field name

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-05-25 Thread Andrew Pashkin
On 05/25/2016 08:36 PM, Mike Bayer wrote: You need to be using join() and not joinedload() here. You shouldn't care about the columns or syntaxes that joinedload() renders. Search the docs for "the zen of eager loading", Yes, I know that, but with join() my question still relevant. What I

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-05-25 Thread Andrew Pashkin
On 05/25/2016 06:01 PM, Mike Bayer wrote: I can make guesses as to what that's asking but I'd rather you clarify. What you do mean "get"? like, render in the FROM clause? or a python accessor like "my_statement.columns" ? the .c. collection there has the columns in the order that they are

Re: [sqlalchemy] How to get unambiguous column name for selectable?

2016-05-25 Thread Andrew Pashkin
On Tuesday, May 24, 2016 at 5:12:32 PM UTC+3, Mike Bayer wrote: > > q = q.order_by(q.with_labels().statement.c.foo_name) > Is that possible to get column objects (or their tables) in the same order as they were joined in Expressions level and/or ORM level? In that case it would be [Foo.name,

[sqlalchemy] How to get unambiguous column name for selectable?

2016-05-24 Thread Andrew Pashkin
SQLAlchemy ORM resolves this collision automatically. But how to do the same in case of using SQLAlchemy expressions? -- With kind regards, Andrew Pashkin. cell phone - +7 (985) 898 57 59 Skype - waves_in_fluids e-mail - andrew.pash...@gmx.co.uk -- You received this message because you are

Re: [sqlalchemy] Calculated relationships

2016-05-21 Thread Andrew Pashkin
On 05/21/2016 09:06 PM, Jonathan Vanasco wrote: feature Looks more like a bug. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [sqlalchemy] Calculated relationships

2016-05-21 Thread Andrew Pashkin
I used this method in conjunction with "Mapping a Class against Arbitrary Selects" - I mapped a query to a model and then added relations to it to other models. ps. It's strange,

[sqlalchemy] Calculated relationships

2016-05-21 Thread Andrew Pashkin
Hello, everyone, there is a way to have calculated scalar fields, using column_property and hybrid_property. But is there a way, to create calculated foreign keys and calculated relationship with SQLAlchemy? -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Strange issue with unicode

2014-07-23 Thread Andrew Pashkin
Hi all! I have an issue with unicode and SQLAlchemy. I've created topic on SO: http://stackoverflow.com/questions/24795444/how-to-save-unicode-with-sqlalchemy And repository with Vagrant/Ansible setup, so you can easily reproduce this bug on your local machine: