Re: [sqlalchemy] Selective logging using the ORM for a single thread. Can't do it, therefore can't debug our app.

2016-10-17 Thread Alfred Perlstein
I was not offended personally, however I was annoyed that a conversation on a topic that I felt helpful to the community was being shut down. When I shared the response I got the feedback was that the received answer fell under was the umbrella of "mansplainining" and how a response such as

[sqlalchemy] Json format on Flask Restful

2016-10-17 Thread Ramesh G
Hi, The api output comes up with the special charaters such as newline and \. The output looks good when i'm executing from the IDE. but while looking towards the url, it shows up like below and not in good format. It becomes trouble while on the retrival. "[{\"INFO\": null, \"SEQ\": 1.0,

Re: [sqlalchemy] ORM and table with no primary key

2016-10-17 Thread Seth P
On Monday, October 17, 2016 at 3:58:36 PM UTC-4, Mike Bayer wrote: > > that error is there right now because we don't emit the "col IS NULL" > SQL within that section of the persistence code. > > took me a long time to find the history on this because I thought it had > been discussed but looks

Re: [sqlalchemy] ORM and table with no primary key

2016-10-17 Thread Mike Bayer
On 10/17/2016 03:36 PM, Seth P wrote: I realize that the orm really wants/needs a table to have a primary key: http://docs.sqlalchemy.org/en/rel_1_1/faq/ormconfiguration.html?#how-do-i-map-a-table-that-has-no-primary-key Alas I have to deal with an existing table with no primary key. That

[sqlalchemy] Re: How to convert sqlalchemy to json format

2016-10-17 Thread Jonathan Vanasco
converting to json would be like this: for row in rows: converted = json.dumps(row) it is possible that your json encoder can not handle a particular sqlalchemy object. if that is the case you will need to build your own json dumps function or encoder that can adapt your data.

[sqlalchemy] ORM and table with no primary key

2016-10-17 Thread Seth P
I realize that the orm really wants/needs a table to have a primary key: http://docs.sqlalchemy.org/en/rel_1_1/faq/ormconfiguration.html?#how-do-i-map-a-table-that-has-no-primary-key Alas I have to deal with an existing table with no primary key. That said, it does have a unique constraint on a

[sqlalchemy] SQLAlchemy 1.1.2 Released

2016-10-17 Thread Mike Bayer
SQLAlchemy release 1.1.2 is now available. Release 1.1.2 includes a small handful of bug fixes, including some small regressions from the 1.0 series, some ORM loading improvements, and a fix to the new PostgreSQL ON CONFLICT feature. Changelog for 1.1.2 is at:

SQLAlchemy 1.1.2 Released

2016-10-17 Thread Mike Bayer
SQLAlchemy release 1.1.2 is now available. Release 1.1.2 includes a small handful of bug fixes, including some small regressions from the 1.0 series, some ORM loading improvements, and a fix to the new PostgreSQL ON CONFLICT feature. Changelog for 1.1.2 is at:

Re: [sqlalchemy] Selective logging using the ORM for a single thread. Can't do it, therefore can't debug our app.

2016-10-17 Thread Jonathan Vanasco
Alfred- I'm sorry you felt offended and misinterpreted my comment. I did not think you were unskilled in the slightest. Quite the opposite (i did look you up). Your concerns and solutions were in-line with to how every highly experienced lower-level engineer I've worked with has approached

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Mike Bayer
On 10/17/2016 11:51 AM, Seth P wrote: On Monday, October 17, 2016 at 11:24:43 AM UTC-4, Mike Bayer wrote: However, I don't see how the ordered attributes fixes anything in terms of mixins. If a mixin wants its columns at the beginning, or the end, all of that can be upended by

[sqlalchemy] Re: JOIN result as dict

2016-10-17 Thread Jonathan Vanasco
Your query's underlying sql returns multiple rows. You can cast those results into a dict in Python. -- 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

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
On Monday, October 17, 2016 at 11:24:43 AM UTC-4, Mike Bayer wrote: > > However, I don't see how the ordered attributes fixes anything in terms > of mixins. If a mixin wants its columns at the beginning, or the end, > all of that can be upended by the presence of other mixins and those >

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Mike Bayer
On 10/17/2016 08:38 AM, Seth P wrote: On Sunday, October 16, 2016 at 10:09:00 AM UTC-4, Mike Bayer wrote: The simplest way is probably to set the creation order of the column to be at the top: col = Column(...) col._creation_order = -10 Great. I will use _creation_order.

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Mike Bayer
On 10/17/2016 09:32 AM, Seth P wrote: On a related note, is there something like after_create events for indexes and sequences? There doesn't seem to be. the indexes and sequences are generated in the context of the Table in which they are associated, so I'd just use the table level

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
On a related note, is there something like after_create events for indexes and sequences? There doesn't seem to be. -- 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

[sqlalchemy] JOIN result as dict

2016-10-17 Thread Joasia Truszkowska
Hi! There is any option to select JOIN result as dict? For example I have: *table1* t1c1| t1c2 -+ 1 | one 2 | two 3 | three *table2* t2c1 | t2c2 | t2c3 -+---+--- 11 | qwe | 1 22 | rty | 2 33 | zxcvb| 1 where t2c3 from *table2 *is a foreign

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
On Sunday, October 16, 2016 at 10:09:00 AM UTC-4, Mike Bayer wrote: > > > > The simplest way is probably to set the creation order of the column to > be at the top: > > col = Column(...) > col._creation_order = -10 Great. I will use _creation_order. Thanks. By the way, in view of PEP 520

[sqlalchemy] How to convert sqlalchemy to json format

2016-10-17 Thread Ramesh G
How to convert sqlalchemy to json format My sample code is below... I'm struggling using various packages..etc. to convert.. the result that was received under variable rows. from flask import Flask, jsonify, json from flask_restful import reqparse, abort, Api, Resource from