[sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-11 Thread shrey . chauhan
Thanks Mike for suggestions, was able to solve both the issues with slight changes in the db models added lazy='dynamic' on both sides where back_populates is being used -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

[sqlalchemy] [alembic] Batch migrations with sqlite and naming conventions

2017-04-11 Thread Peter Erickson
I'm sure that I'm missing a subtle point with batch migrations and naming conventions for SQLite databases, but I can't figure out what I'm doing wrong. After renaming a table, I'm using a batch migration to update a foreign key in a child table. However, after recreating the child table 2

Re: [sqlalchemy] postgresql tuple as function argument

2017-04-11 Thread mike bayer
I will say that the psycopg2 driver is not supporting this, however, it isn't parsing out the tuple. Using postgresql.ARRAY we get an answer like: ['{', '"', '(', 'x', ',', 'y', ')', '"', ',', '"', '(', 'x', ',', 'y', ')', '"', '}'] that is, the string coming back is being interpreted

Re: [sqlalchemy] postgresql tuple as function argument

2017-04-11 Thread mike bayer
can't reproduce (though the ARRAY(unicode) type is not what psycopg2 returns, and there seems to be a difference in behavior between sqlalchemy.ARRAY and sqlalchemy.dialects.postgresql.ARRAY). please provide a complete example based on the below test script and stack traces also my PG

[sqlalchemy] postgresql tuple as function argument

2017-04-11 Thread Антонио Антуан
Hi I want to build such query with sqlalchemy: SELECT array_agg((column1, column2)) from table Using psql it works perfectly and returns such result: {"(col1_row1_value, col2_row1_value)", "(col1_row2_value, col2_row2_value)" ...} I tried several forms of SQLA-query: >> from

Re: [sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-11 Thread mike bayer
On 04/11/2017 02:37 AM, shrey.chau...@invicto.in wrote: Yes Mike will do that, mostly its marshmallow model schema which is creating the object, as I am using Flask + marshmallow for APIs, p.groups=[] //when i try to empty it, i get this exception *AssertionError: Collection was

Re: [sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-11 Thread shrey . chauhan
Yes Mike will do that, mostly its marshmallow model schema which is creating the object, as I am using Flask + marshmallow for APIs, apart from that I have another issue, which i am not able to uderstand: I have a many-to-many relationship between 2 models, same as posted above, still ill put