Re: [sqlalchemy] How to retrieve stored procedure and function list from reflection inspector / meta data

2018-05-07 Thread siddhesh
Ok. Thanks Mike Bayer. On Sunday, May 6, 2018 at 6:39:24 PM UTC+5:30, Mike Bayer wrote: > > On Sun, May 6, 2018 at 3:28 AM, wrote: > > Hi, > > > > I am new in the python (sql alchemy). I want to retrieve all database > > objects at my code level. I am able to read

Re: [sqlalchemy] generate select table.* query using sql alchemy

2018-05-07 Thread siddhesh
Its really superb. Its works like charm. Thanks a lot Mike Bayer. On Sunday, May 6, 2018 at 6:46:11 PM UTC+5:30, Mike Bayer wrote: > > On Sun, May 6, 2018 at 4:15 AM, wrote: > > Hi, > > I am using sqlalchemy core. I want to generate select query with > > table_name.*

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-07 Thread jiajunsu . zju
We added coroutine_id in psycopg2, and found that two coroutine use the same connection before the pthread_mutex_lock released. Maybe something in the connection pool goes wrong? [pid] [coroutine_id] msg [49174] [0xa5db730]before PyObject_CallFunctionObjArgs conn 0x94122f0, cb 0x23ad320

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-07 Thread Mike Bayer
On Mon, May 7, 2018, 7:01 AM wrote: > We added coroutine_id in psycopg2, and found that two coroutine use the > same connection before the pthread_mutex_lock released. > > Maybe something in the connection pool goes wrong? > [pid] [coroutine_id] msg > This seems

[sqlalchemy] Table CheckConstraint() limit?

2018-05-07 Thread Rich Shepard
The module, models.py, has five classes. Each has table constraints: three have a single table constraint, one has two table constraints, and one has seven table constraints. SA seems to reject more than four table constraints. With the last three commented out, there's no error:

Re: [sqlalchemy] Column CheckConstraint() question

2018-05-07 Thread Rich Shepard
On Sun, 6 May 2018, Mike Bayer wrote: the second approach is probably more common, as it's more compact. Thanks, Mike. It works well here. Best regards, Rich -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please

[sqlalchemy] Data type Float not recognized

2018-05-07 Thread Rich Shepard
SQLAlchemy-1.2.7 installed here. Model column definition is: quant = Column(Float, nullable=False) yet Python3 tells me that Float is not defined: quant = Column(Float, nullable=False) NameError: name 'Float' is not defined If Float was a variable I created it would need to

Re: [sqlalchemy] Data type Float not recognized [FIXED]

2018-05-07 Thread Rich Shepard
On Mon, 7 May 2018, Rich Shepard wrote: What have I missed? Forgot to import that data type to the module. Mea culpa! Rich -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete,

Re: [sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Mike Bayer
can you please just post a simple failing test? there's nothing unusual about any of these stack traces. I don't know what you're trying to do. On Mon, May 7, 2018 at 10:52 PM, Colton Allen wrote: > Sorry to spam you. The logs didn't paste in full. > > > api_1 |

Re: [sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Jonathan Vanasco
On Monday, May 7, 2018 at 10:27:03 PM UTC-4, Mike Bayer wrote: > > can you perhaps place a "pdb.set_trace()" inside of session._flush()? > using the debugger you can see the source of every flush() call. > Generally, it occurs each time a query is about to emit SQL. > > Building off what Mike

[sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Colton Allen
What exactly causes the session to flush? I'm trying to track down a nasty bug in my versioning system. Sorry for the long code dump. I retooled examples/versioned_history/history_meta.py so it should look familiar. The function that's breaking is "column_has_changed". I've added some logs

Re: [sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Colton Allen
I think I did it right. The logs just didn't scroll up. This might be causing the issue (account is a orm.relationship). api_1 | File "/app/models/post/__init__.py", line 160, in manage_review_status api_1 | if not target.account.settings.compliance_enable_post: Full logs:

Re: [sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Colton Allen
New to pdb. Does this look correct? class DebugSession(Session): def _flush(self, objects=None): pdb.set_trace() super()._flush(objects) factory = sqlalchemy.orm.sessionmaker(bind=engine, class_=DebugSession) Program terminates when trying to call _flush(). api_1 | >

Re: [sqlalchemy] Inconsistent flushing preventing "get_history" from working

2018-05-07 Thread Colton Allen
Sorry to spam you. The logs didn't paste in full. api_1 | Traceback (most recent call last): api_1 | File "/usr/local/lib/python3.5/site-packages/werkzeug/wsgi.py", line 660, in __call__ api_1 | return app(environ, start_response) api_1 | File

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-07 Thread Mike Bayer
just to note, there's definitely a bug somewhere, and if the bug is found there's a 90% chance it involves code that I wrote at some point :) (though likely some assumption that the PG /async stuff does not meet) but this is part of oslo / openstack. I work on oslo / openstack, but that's my

[sqlalchemy] TypeError: recv_into() arg 1 must be pinned buffer, not byte array

2018-05-07 Thread Anvith Shivakumara
Well this a weird question to be asking at this point. I have been working on a legacy web service and it's written in Python 2.6(maybe legacy is an underrated word here :D) and have been using SQL Alchemy 1.0.0 with PyMySQL 0.8.0. Every time I try to query, I get the following error:

Re: [sqlalchemy] Table CheckConstraint() limit?

2018-05-07 Thread Mike Bayer
On Mon, May 7, 2018 at 11:31 AM, Rich Shepard wrote: > The module, models.py, has five classes. Each has table constraints: three > have a single table constraint, one has two table constraints, and one has > seven table constraints. SA seems to reject more than four

Re: [sqlalchemy] Table CheckConstraint() limit?

2018-05-07 Thread Rich Shepard
On Mon, 7 May 2018, Mike Bayer wrote: the CHECK constraint only accepts a single SQL expression. Above, it looks like you re looking to add a CHECK constraint for each expression: __table_args__ = ( CheckConstraint(wtemp_unit.in_(['C', 'F'])), CheckConstraint(atemp_unit.in_(['C', 'F'])),

Re: [sqlalchemy] TypeError: recv_into() arg 1 must be pinned buffer, not byte array

2018-05-07 Thread Mike Bayer
On Mon, May 7, 2018 at 1:45 PM, Anvith Shivakumara wrote: > Well this a weird question to be asking at this point. > > I have been working on a legacy web service and it's written in Python > 2.6(maybe legacy is an underrated word here :D) and have been using SQL > Alchemy