Re: [sqlalchemy] Slow insert with cx_oracle through sqlalchemy

2018-06-27 Thread Mike Bayer
As you know SQLAlchemy has to call setinputsizes. This is an event hook that let's you change what it will do. You use event.listen along with your create_engine call and that's it. The rest of that program is just an example. On Wed, Jun 27, 2018, 2:59 PM naor volkovich wrote: > Thanks for

Re: [sqlalchemy] Slow insert with cx_oracle through sqlalchemy

2018-06-27 Thread naor volkovich
Thanks for adding this feature! Since I don't know SQLAlchemy that good yet, can you explain exactly what's going on? Do I have to do all the Base related lines? What do they do? If I add this event for an engine in one file/class, does it affect that engine when passed around to other

Re: [sqlalchemy] Slow insert with cx_oracle through sqlalchemy

2018-06-27 Thread Mike Bayer
the feature at https://gerrit.sqlalchemy.org/#/c/zzzeek/sqlalchemy/+/795/ will be part of SQLAlchemy 1.2.9 and will allow the following program to work: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import event

Re: [sqlalchemy] Debugging why Flask-SQLAlchemy won't update database

2018-06-27 Thread Jonathan Vanasco
Adding to Mike's response... I think you're using two sessions... you select this: user = Users.query.filter_by(username='foo').first() and save this db.session.add(user) when you select, i think that's using some flask-sqlalchemy syntactic sugar to select the session. a 'raw'

Re: [sqlalchemy] Re: from_statement NOW()

2018-06-27 Thread Mike Bayer
I apologize for my inpatient tone in my previous email. I would hope that everyone in this mailing list feels welcome. On Wed, Jun 27, 2018, 10:59 AM Mike Bayer wrote: > this is a very simple issue to debug with basic programming > techniques, first off, put echo='debug' in your create_engine

Re: [sqlalchemy] get max value from multiple columns sqlalchemy

2018-06-27 Thread Mike Bayer
On Wed, Jun 27, 2018 at 3:22 AM, arjun k wrote: > Hi > i was trying to convert the below query to sqlalchemy > > > SELECT >addr_idn, >(SELECT MAX(LastUpdateDate) > FROM (VALUES (crt_dt),(upd_dt),) AS UpdateDate(LastUpdateDate)) >AS LastUpdateDate > FROM ( > select a.

Re: [sqlalchemy] Re: from_statement NOW()

2018-06-27 Thread Mike Bayer
this is a very simple issue to debug with basic programming techniques, first off, put echo='debug' in your create_engine so you can see all SQL and results: e = create_engine("postgresql://scott:tiger@localhost/test", echo='debug') next, if you are running over to a SQL command line vs.

Re: [sqlalchemy] Debugging why Flask-SQLAlchemy won't update database

2018-06-27 Thread Mike Bayer
On Wed, Jun 27, 2018 at 5:14 AM, wrote: > Hello, > > I'm hoping someone might have advice on how to track down this problem or > what might be causing it. I don't have code that I can use to recreate the > issue as I'm not able to recreate it outside of one instance of the same > codebase (I've

Re: [sqlalchemy] Re: from_statement NOW()

2018-06-27 Thread Danila Ganchar
Ok. I ran the script 10 times on a clean table. Now I run raw sql: SELECT * FROM test_user WHERE (last_receive_time + INTERVAL '1 second' * timeout) < NOW(); The result: 10 records. Now I run script one more time. Still 0 records using from_statement. amount records using NOW() = 0 As I

[sqlalchemy] Debugging why Flask-SQLAlchemy won't update database

2018-06-27 Thread chbrnola
Hello, I'm hoping someone might have advice on how to track down this problem or what might be causing it. I don't have code that I can use to recreate the issue as I'm not able to recreate it outside of one instance of the same codebase (I've got a local development environment, and two test

[sqlalchemy] get max value from multiple columns sqlalchemy

2018-06-27 Thread arjun k
Hi i was trying to convert the below query to sqlalchemy SELECT addr_idn, (SELECT MAX(LastUpdateDate) FROM (VALUES (crt_dt),(upd_dt),) AS UpdateDate(LastUpdateDate)) AS LastUpdateDate FROM ( select a. addr_idn,a.crt_dt crt_dt , b.upd_dt upd_dt from emp_addr where