Re: [sqlalchemy] SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Mike Bayer
On Mon, Jan 15, 2018 at 6:09 PM, Mike Bayer wrote: > On Mon, Jan 15, 2018 at 5:32 PM, Mike Bayer wrote: > > that's not quite right, because I'm not selecting from Test. Adding > the JOIN back in, I've tried aliasing Test everywhere and it

Re: [sqlalchemy] SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Mike Bayer
On Mon, Jan 15, 2018 at 5:32 PM, Mike Bayer wrote: > On Mon, Jan 15, 2018 at 4:47 PM, Lukas Barth wrote: >> Hi, >> >> first things first: I put a complete notebook showing the problem at [0], >> I'll only post the excerpts I deem useful below. The

[sqlalchemy] First application: visual linting requested

2018-01-15 Thread Rich Shepard
Several years ago I started a project with SQLAlchemy but dropped development to go in a different direction. Recently returning to the project I recognized my error and have returned to SQLAlchemy for this application (using version 1.2.1). I've read the ORM tutorial and followed links on

Re: [sqlalchemy] SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Mike Bayer
On Mon, Jan 15, 2018 at 4:47 PM, Lukas Barth wrote: > Hi, > > first things first: I put a complete notebook showing the problem at [0], > I'll only post the excerpts I deem useful below. The exact same code, this > time working, with an sqlite in-memory database is at [1]. I'm

[sqlalchemy] Re: SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Jonathan Vanasco
I can't speak to the internals of this being a bug or not, or how this should be done... but I think you could do a short-term (and cross platform) fix using an alias via `sqlalchemy.orm.aliased` for one (or more) of the inner subqueries. That should result in a unique discriminator being

Re: [sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-15 Thread Mike Bayer
On Mon, Jan 15, 2018 at 3:18 PM, Stefan Schwarzer wrote: > On 2018-01-12 16:33, Mike Bayer wrote:> On Fri, Jan 12, 2018 at 7:14 AM, > Stefan Schwarzer >> wrote: >> In SQLAlchemy 1.1 series and earlier, you can specify >>

Re: [sqlalchemy] Define more events with sqlalchemy.event.Events

2018-01-15 Thread Mike Bayer
On Sat, Jan 13, 2018 at 2:38 PM, Gleb Getmanenko wrote: > I would like to define my event "after_create" for class Engine which I > would invoke with > > eng = create_engine('sqlite:///:memory:') > eng.dispatch.after_create(eng) > > I tried this to do this by > > class

[sqlalchemy] SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Lukas Barth
Hi, first things first: I put a complete notebook showing the problem at [0], I'll only post the excerpts I deem useful below. The exact same code, this time working, with an sqlite in-memory database is at [1]. I'm using SQLAlchemy version 1.2.1, python 3.5, mysqlclient version 1.3.12 and

[sqlalchemy] Re: SQLAlcemy relationships that work with MySQL generate error when used with Sql Server

2018-01-15 Thread michael lovett
I think I figure this out: down voteunaccept In addition to mentioning the SQL Server schema names as part of the table args, as in: class UserGroup(Base): __tablename__ = 'user_group' __table_args__ = ( {'schema': 'admn'}) The schema is named "admn". You also have to

Re: [sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-15 Thread Stefan Schwarzer
On 2018-01-12 16:33, Mike Bayer wrote:> On Fri, Jan 12, 2018 at 7:14 AM, Stefan Schwarzer > wrote: > In SQLAlchemy 1.1 series and earlier, you can specify > exclude_setinputsizes=() to have STRING be part of the automatic > setinputsizes call. In SQLAlchemy 1.2 these

SQLAlchemy 1.2.1 released

2018-01-15 Thread Mike Bayer
SQLAlchemy release 1.2.1 is now available. Release 1.2.1 fixes some minor issues for the newly released 1.2 series, including a few small regressions as well as some issues reported with the new "selectin" relationship and polymorphic loader features. Changelog for 1.2.1 is at:

[sqlalchemy] SQLAlchemy 1.2.1 released

2018-01-15 Thread Mike Bayer
SQLAlchemy release 1.2.1 is now available. Release 1.2.1 fixes some minor issues for the newly released 1.2 series, including a few small regressions as well as some issues reported with the new "selectin" relationship and polymorphic loader features. Changelog for 1.2.1 is at:

Re: [sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-15 Thread Simon King
Yes, if you can't find where you are creating new Satellite instances, I'd probably stick an assert statement in Satellite.__init__ and see where it gets triggered. Simon On Mon, Jan 15, 2018 at 10:34 AM, Ruben Di Battista wrote: > Dear Simon, > > thanks again for

Re: [sqlalchemy] About multithread session (scoped session)

2018-01-15 Thread Simon King
That's a bit of a complicated topic. Database consistency is generally ensured by using transactions with an isolation level that is appropriate for your usage. Each thread/connection will be operating in a transaction. The transaction isolation level determines when one thread will see the

Re: [sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-15 Thread Ruben Di Battista
Dear Simon, thanks again for your kind help. Actually the creation of new instances is not intended. But I'm not getting where they are created... I give you more insight: This is the scheduler object with the associated propagate() method class Scheduler(six.with_metaclass(abc.ABCMeta)):

Re: [sqlalchemy] About multithread session (scoped session)

2018-01-15 Thread gingerluo
Simon, Thanks for your kind answer. So when I have several threads trying to insert/update the same database (pgsql or sqlite) at the same time, how can I ensure consistency? By using scoped session? This will rely on the DB implementation behind, right? 在 2018年1月15日星期一 UTC+8下午5:21:42,Simon

Re: [sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-15 Thread Simon King
On Sat, Jan 13, 2018 at 3:31 PM, Ruben Di Battista wrote: > > > On Friday, January 12, 2018 at 10:54:49 AM UTC+1, Simon King wrote: >> >> If I understand your code correctly, scheduler.propagate() creates a >> large number of Passage instances, and you only want a small

[sqlalchemy] About multithread session (scoped session)

2018-01-15 Thread gingerluo
Hello, Sessions are not thread safe. But for the scoped sessions, each thread will have its own session, my question is, even the scoped session itself rely on the thread safety feature of the DB behind? for example, PGSQL server may handle multiple connections and resolving the update/insert