Re: [sqlalchemy] How to make polymorphic identity condition involving a join not be a subselect

2017-11-27 Thread Mischa S
I tried doing this, it seems to kind of work: class TestTask(Task): """Test task - only for use in tests.""" __tablename__ = None # suuper needed without it polymorphic filter will not work task_type_name = TaskTypeEnum.test_worker_task.value @task def

Re: [sqlalchemy] How to implement a conditional insert (MySQL)

2017-11-27 Thread jens . troeger
Hah 樂 Boy this is (not really) funny. Thank you for digging into this, Mike! I had to make two minor import adjustments from sqlalchemy.sql.elements import quoted_name from sqlalchemy.sql.expression import literal_column

Re: [sqlalchemy] How to make polymorphic identity condition involving a join not be a subselect

2017-11-27 Thread Mischa S
On Tuesday, November 28, 2017 at 4:10:42 AM UTC+13, Simon King wrote: > > On Sun, Nov 26, 2017 at 11:19 AM, Mischa S > wrote: > > I want to have a polymorphic table that gets its identity from a column > in a > > "type" table. I have a "task" table and a "task_type"

Re: [sqlalchemy] How to implement a conditional insert (MySQL)

2017-11-27 Thread Mike Bayer
On Mon, Nov 27, 2017 at 4:02 PM, wrote: > > > No problem, here it is. To work with your initial code example... > e = create_engine("mysql+pymysql://jens@localhost/test?charset=utf8_socket=/opt/local/var/run/mysql56/mysqld.sock", echo=True)

Re: [sqlalchemy] How to implement a conditional insert (MySQL)

2017-11-27 Thread jens . troeger
No problem, here it is. To work with your initial code example... >>> e = create_engine("mysql+pymysql://jens@localhost/test?charset=utf8_socket=/opt/local/var/run/mysql56/mysqld.sock", echo=True) >>> Base.metadata.drop_all(e) 2017-11-28 06:47:21,171 INFO sqlalchemy.engine.base.Engine SHOW

Re: [sqlalchemy] How to make polymorphic identity condition involving a join not be a subselect

2017-11-27 Thread Simon King
On Sun, Nov 26, 2017 at 11:19 AM, Mischa S wrote: > I want to have a polymorphic table that gets its identity from a column in a > "type" table. I have a "task" table and a "task_type" table. I want to be > able to create task subclasses that say something like: > >

Re: [sqlalchemy] How to implement a conditional insert (MySQL)

2017-11-27 Thread Mike Bayer
On Sun, Nov 26, 2017 at 9:39 PM, wrote: > Thank you, Mike! > > I’ve tried to implement what we talked about above, but had a few problems. > First, I was unable to use MySQLdb because of compilation errors; instead > I’ve used pymysql for a while now. When I tried to run