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

2018-02-18 Thread Andrew Pashkin
Mike, are you open to to making sqlalchemy.orm.composite to accept keyword 
arguments to use for instantiation of the class? In that case - what 
signature should it have?

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 
> > wrote:
>
>> 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 and Object Relational Mapper
>>  
>> http://www.sqlalchemy.org/
>>  
>> To post example code, please provide an MCVE: Minimal, Complete, and 
>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
>> description.
>> --- 
>> 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+...@googlegroups.com .
>> To post to this group, send email to sqlal...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 
> > wrote:
>
>> 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 and Object Relational Mapper
>>  
>> http://www.sqlalchemy.org/
>>  
>> To post example code, please provide an MCVE: Minimal, Complete, and 
>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
>> description.
>> --- 
>> 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+...@googlegroups.com .
>> To post to this group, send email to sqlal...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[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 and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[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 table. At the same time it is possible to 
define a column with index=True on a child class, which alters the parent 
table the same way as __table_args__.

Here is my setup:

import sqlalchemy as sa
import sqlalchemy.ext.declarative

from sqlalchemy.ext.declarative import declarative_base


Base = declarative_base()


class A(Base):
__tablename__ = 'a'

id = sa.Column(sa.Integer, primary_key=True)
type = sa.Column(sa.Text, nullable=False)

__mapper_args__ = {
'polymorphic_on': type,
}


class B(A):
b = sa.Column(sa.Integer, index=True)

__mapper_args__ = {
'polymorphic_identity': 'b',
}


class C(A):
c = sa.Column(sa.Integer)

__mapper_args__ = {
'polymorphic_identity': 'c',
}

__table_args__ = (
sa.Index('ix_test', c),
)


engine = sa.engine.create_engine("sqlite://", echo=True)
Base.metadata.create_all(engine)
session = sa.orm.Session(engine)

session.add_all([
B()
])

session.commit()

print(session.query(A))


And it throws:

Traceback (most recent call last):
 File "test.py", line 29, in 
   class C(A):
 File 
"/home/andrei/projects/my_project/.tox/dev/lib/python3.5/site-packages/sqlalchemy/ext/decla
rative/api.py", line 64, in __init__
   _as_declarative(cls, classname, cls.__dict__)
 File 
"/home/andrei/projects/my_project/.tox/dev/lib/python3.5/site-packages/sqlalchemy/ext/decla
rative/base.py", line 88, in _as_declarative
   _MapperConfig.setup_mapping(cls, classname, dict_)
 File 
"/home/andrei/projects/my_project/.tox/dev/lib/python3.5/site-packages/sqlalchemy/ext/decla
rative/base.py", line 103, in setup_mapping
   cfg_cls(cls_, classname, dict_)
 File 
"/home/andrei/projects/my_project/.tox/dev/lib/python3.5/site-packages/sqlalchemy/ext/decla
rative/base.py", line 133, in __init__
   self._setup_inheritance()
 File 
"/home/andrei/projects/my_project/.tox/dev/lib/python3.5/site-packages/sqlalchemy/ext/decla
rative/base.py", line 442, in _setup_inheritance
   "Can't place __table_args__ on an inherited class "
sqlalchemy.exc.ArgumentError: Can't place __table_args__ on an inherited 
class with no table.

Do somebody know any workarounds? 

-- 
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  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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

2017-04-15 Thread Andrew Pashkin

Hello, everyone!

Here is an example of generic relation with association_proxy:

http://docs.sqlalchemy.org/en/rel_1_1/_modules/examples/generic_associations/discriminator_on_association.html

It works great, but I've found one issue. If you add to the end of the 
code something like that:


session.add(Address(
street='123 anywhere street',
city="New York",
zip="10110",
parent=Customer(name='customer 1')
))

It won't work. What I've done here is that instead of assigning Address 
instance to a Customer instance, I reversed it. And it throws an error.


I would 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 MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 expressions?


--
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 

Here is the full "input":

   import sqlalchemy as sa
   from sqlalchemy.ext.declarative import declarative_base


   engine = sa.create_engine('sqlite:///:memory:', echo=True)
   Base = declarative_base()


   class Foo(Base):
__tablename__ = 'foo'

id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)

def __repr__(self):
return 'Foo(id=%s, name="%s")' % (self.id, self.name)


   class Bar(Base):
__tablename__ = 'bar'

id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)
foo_id  = sa.Column(sa.Integer, sa.ForeignKey('foo.id'),
nullable=False)
foo = sa.orm.relationship('Foo', backref='bars')


   Base.metadata.create_all(engine)
   Session = sa.orm.sessionmaker(bind=engine)
   session = Session()

   baz = Foo(name='baz')
   qux = Foo(name='qux')

   session.add(baz)
   session.add(qux)
   session.add(Bar(name='spam', foo=baz))
   session.add(Bar(name='parrot', foo=baz))
   session.commit()

   q = session.query(Foo).outerjoin(Bar)
   q = q.order_by('name')
   print(q)

Here is the output:

   SELECT foo.id AS foo_id, foo.name AS foo_name
   FROM foo
   LEFT OUTER JOIN bar
   ON foo.id = bar.foo_id
   ORDER BY *bar.name*

While desired output is ORDER BY foo.name.

Here is my solution:

   def get_leftmost(selectable):
current = selectable.froms[0]
while True:
if hasattr(current, 'left'):
current = current.left
elif hasattr(current, 'append'):
current = current[0]
elif hasattr(current, 'columns'):
return current
else:
raise AssertionError

   print(q.order_by(get_leftmost(q.statement).c.name))

It gives me:

   SELECT foo.id AS foo_id, foo.name AS foo_name
   FROM foo LEFT OUTER
   JOIN bar ON foo.id = bar.foo_id
   ORDER BY *foo.name*

Which is what I want. But /a)/ it's too hacky /b)/ I'm not sure if froms 
guarantees any ordering.


--
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 in a given query to an unambiguous column reference, to 
use it for sorting and filtering.

what makes Foo be first?

Well, my idea is, that for this query:

   SELECT foo.name, bar.name FROM foo LEFT JOIN bar ON ...

foo is the first, because it's in the FROM part and bar is the second, 
because it's being joined.


This logic is analogous to how Django ORM works with relations. In such 
query - Foo.objects.select_related('bars'), Django allows user to 
reference columns in this way: 
.filter(bars__name='spam').filter(name='parrot') - notice, in the latter 
filter(), Django resolves name as Foo.name, because it was in FROM.


--
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 
want to do is for given column name  and an arbitrary SA query - 
retrieve unambiguous reference to the actual column of that query with 
priority to those columns, which are "closer" to the root SELECT.


So for SELECT foo.name, bar.name FROM foo LEFT JOIN bar ON ... and 
column name "name", I would like to build a function, that would return 
a reference to a column object for foo.name.


I found a way of doing this, using froms attribute and finding original 
SELECT by walking down relations, listed in it. But I wonder if there 
are better ways.


--
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 rendered in the 
columns clause, it's iterable.
By "order" I meant, that in SELECT ... FROM foo LEFT JOIN bar ON ... 
query, the columns of foo would be placed first and the columns of bar 
second.
And by "get" I meant Column objects or something else, that would 
unambiguously define them.


--
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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, Bar.name].

-- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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

2016-05-24 Thread Andrew Pashkin

Here is the working example:

   import sqlalchemy as sa
   from sqlalchemy.ext.declarative import declarative_base


   engine = sa.create_engine('sqlite:///:memory:', echo=True)
   Base = declarative_base()


   class Foo(Base):
__tablename__ = 'foo'

id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)

def __repr__(self):
return 'Foo(id=%s, name="%s")' % (self.id, self.name)


   class Bar(Base):
__tablename__ = 'bar'

id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)
foo_id  = sa.Column(sa.Integer, sa.ForeignKey('foo.id'),
nullable=False)
foo = sa.orm.relationship('Foo', backref='bars')


   Base.metadata.create_all(engine)
   Session = sa.orm.sessionmaker(bind=engine)
   session = Session()

   baz = Foo(name='baz')
   qux = Foo(name='qux')

   session.add(baz)
   session.add(qux)
   session.add(Bar(name='spam', foo=baz))
   session.add(Bar(name='parrot', foo=baz))
   session.commit()

   q = session.query(Foo).options(sa.orm.joinedload('bars'))
   q = q.order_by(q.statement.c.name)
   # q = q.order_by(Foo.name)  # Doesn't give an error

   print(q.all())

   # Gives:
   #
   # sqlalchemy.exc.OperationalError: (sqlite3.OperationalError)
   # ambiguous column name: name

Here I have a two tables with columns name and one references another 
with FK. When they are joined - name becomes ambiguous, and 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 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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


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, why I don't see the first post in the thread?


-- 
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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[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" 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.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[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:
https://github.com/AndrewPashkin/sqlalchemy_pg_unicode_save_fail

In short - I just get UnicodeEncodeError when trying to save one specific 
Unicode symbol ('\u2013') with SQLAlchemy.

Does anybody know how this can be handled?

ps
The most weird thing here is that, author of this test case:
http://stackoverflow.com/a/24798089/1818608
does not get such error, as I am.

-- 
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.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.