Re: [sqlalchemy] How to have MySQL store TIMESTAMP but return timezone-aware datetime objects

2019-06-28 Thread Charles-Axel Dein
Thanks so much for the detailed answer Mike, and for the quick fix! You're the best. On Thu, Jun 27, 2019 at 7:13 PM Mike Bayer wrote: > > > On Thu, Jun 27, 2019, at 12:02 PM, Charles-Axel Dein wrote: > > Hi, > > I'm trying to have a deleted_at column on my records. I u

[sqlalchemy] How to have MySQL store TIMESTAMP but return timezone-aware datetime objects

2019-06-27 Thread Charles-Axel Dein
deleted_at` timestamp(6) NULL DEFAULT NULL How can I have the custom type respect server_onupdate and nullable? Thanks, Charles -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and V

Re: [sqlalchemy] Re: Announcing SQLAlchemy Dialect for Apache Drill

2019-01-08 Thread Charles Givre
On Tuesday, January 8, 2019 at 9:50:48 AM UTC-5, Charles Givre wrote: > All, > John Omernik and I (mainly John) have been working on an SQLAlchemy dialect > for Apache Drill. Our main goal is to get Drill to work with Apache > Superset, but I'm sure it will have other uses.

[sqlalchemy] Announcing SQLAlchemy Dialect for Apache Drill

2019-01-08 Thread Charles Givre
All, John Omernik and I (mainly John) have been working on an SQLAlchemy dialect for Apache Drill. Our main goal is to get Drill to work with Apache Superset, but I'm sure it will have other uses. Anyway, I'd like to ask if the dialect could be included in the SQLAlchemy Docs in the list of

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
n, May 28, 2018 at 3:01 PM, Charles Langlois > wrote: > >> Yes, that is the case, sorry for the lack of context. >> >> Example: >> >> query = delete(MyMapper.__table__).where(MyMapper.my_column == value) >> result = session.execute(explain(query)) # exceptio

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
ert(), update() , or delete() into > the explain() ? that codepath wouldn't be called otherwise, or if > you can show me exactly how to reproduce we can update the recipe. > thanks! > > On Mon, May 28, 2018 at 11:51 AM, Charles Langlois > wrote: > > Following the recipe to create

[sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
ot;/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor yield File "/usr/lib/python3.6/unittest/case.py", line 523, in subTest yield File "/home/charles/PycharmProjects/my_project/models.py", line 39, in test_delete_cascade result = self.ses

Re: [sqlalchemy] Concrete Mapper does not implement attribute at the instance level. Add this property explicitly to Mapper.

2018-02-15 Thread Charles Langlois
I see. Thanks a lot for the quick response! I'll be looking forward to 1.2.3. Le jeudi 15 février 2018 18:01:38 UTC-5, Mike Bayer a écrit : > > On Thu, Feb 15, 2018 at 4:48 PM, Charles Langlois <cha...@konversion.ca > > wrote: > > I believe my problem is related to >

[sqlalchemy] Concrete Mapper does not implement attribute at the instance level. Add this property explicitly to Mapper.

2018-02-15 Thread Charles Langlois
refer to `attribute1` on an instance if Concrete2, I get an AttributeError: ... File "/home/charles/PycharmProjects/MyProject/models/setup/model.py", line 350, in generate_seasonality x = concrete2_instance.attribute1 File "/home/charles/PycharmProjects/Konversion_Platfo

Re: [sqlalchemy] Query a query in SQLAlchemy

2018-02-09 Thread Charles Heizer
. For example you may have a very large query, which you can then cache. Then you can run additional queries on that cache query to filter the results. Thanks, Charles On Friday, February 9, 2018 at 3:41:26 AM UTC-8, Simon King wrote: > > On Fri, Feb 9, 2018 at 6:06 AM, Charles Heizer <ceh...@

[sqlalchemy] Query a query in SQLAlchemy

2018-02-08 Thread Charles Heizer
Hello, does anyone know if it's possible to query a query result in SQLAlchemy? Thanks! -- 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

[sqlalchemy] More complete support for Views

2017-11-08 Thread charles
So I'm trying to add support for Views, following a few recipes like this , and this . Beyond the DDL element, I'd like

Re: [sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-30 Thread Charles Langlois
ario and ACB > is still pretty hacky. > > > > > > > > > session.expire(results[0]) > > results[0].start > > > > Traceback (most recent call last): > > File > > "/home/charles/PycharmProjects/MyProject/env/ > lib/python3.6/si

Re: [sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread charles
"/home/charles/PycharmProjects/MyProject/env/lib/python3.6/site-packages/IPython/core/interactiveshell.py" , line 3035, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in results[0].start File "/home/charles/PycharmProjects/MyPr

[sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread charles
My SQLAlchemy version is 1.1.14. I'm having difficulty understanding behaviours around a polymorphic hierarchy. I have an AbstractConcreteBase and two subclasses. The ACB declares some attributes shared by the two subclasses, and the subclasses have attributes of their own that are not

Re: [sqlalchemy] Change the logical column order

2016-10-11 Thread Charles Heizer
Cols = sorted(cols, key=getDoc) def getDoc(col_obj): return col_obj.doc This seems to work really well. I now can also allow users to change column order in my app and save their settings as well. Thanks, Charlie On Monday, October 10, 2016 at 7:25:04 PM UTC-7, Mike Bayer wrote: > >

[sqlalchemy] Change the logical column order

2016-10-10 Thread Charles Heizer
Hello, I'm not sure if I'm asking this correctly. I'm fairly new to using SQLAlchemy so I'm sorry if I'm not using the correct terminology. How do I change the returning column order on a query? Is there an easy way? I would like to make 'mdate' be the last column. Thanks! Example: *Model*

Autogenerate regenerates base mixin FKs

2016-09-08 Thread Charles Chin
I have something similar to this setup from sqlalchemy.ext.declarative import declared_attr class BaseClass(object): @declared_attr def created_by return created_by = sa.Column(sa.Integer(), sa.ForeignKey()) class RealDBObject(BaseClass): Alembic with autogenerate always

Re: [sqlalchemy] Extend Column Class

2016-06-07 Thread Charles Heizer
Awesome, thanks. I guess I should have read the docs better ;-) Charles On Tuesday, June 7, 2016 at 9:00:09 AM UTC-7, Mike Bayer wrote: > > Just stick it in the .info dictionary which is designed for this purpose: > > > > http://docs.sqlalchemy.org/en/rel_1_0/core/metad

[sqlalchemy] Extend Column Class

2016-06-07 Thread Charles Heizer
ted doing this would be great, I'm brand new to SQLAlchemy and Flask. Thanks! Charles -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

[sqlalchemy] correlate() with aliases having no effect on FROM clause in 1.0.8?

2015-10-02 Thread Charles Duffy
>From a StackOverflow answer describing use of the correlate() call in SQLALchemy, at http://stackoverflow.com/questions/13056049/how-to-specify-the-from-tables-in-sqlalchemy-subqueries : >>> print str(q1) SELECT t3.id AS t3_id FROM tbl AS t3, tbl AS t1 WHERE t3.id < t1.id ORDER BY t3.id DESC

Re: [sqlalchemy] PostgreSQL UNION with ORDER or LIMIT parenthesis patch

2015-04-01 Thread Charles Leifer
Funnily enough I ran into this particular question regarding Peewee ORM and, googling Postgresql UNION parentheses, I found this post. I ran into the same thing where PG likes the parentheses, but SQLite doesn't. I know this is a very old post, but out of curiosity, how did you end up resolving

[sqlalchemy] Should an empty HSTORE be returned as an empty dict?

2013-03-11 Thread Charles-Axel Dein
Hi, Currently, when getting an empty HSTORE column from a model instance, it is returned as None. Do you think it would be more logical to have it returned as an empty dict? Thanks, Charles -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] Keeping soft deletion atomic in spite of model methods calling commit

2012-12-21 Thread Charles-Axel Dein
Thanks Michael. Always spot on. And I don't think I can find a more authoritative source ;) On Wed, Dec 19, 2012 at 5:48 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 19, 2012, at 4:29 AM, charlax wrote: So the problem here is that the rollback does nothing, because there's a

Re: [sqlalchemy] Getting TimeoutError with SqlAlchemy

2012-09-11 Thread Charles-Axel Dein
! Charles -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/4ZcTN0cHDnIJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from

Re: [sqlalchemy] Getting TimeoutError with SqlAlchemy

2012-09-11 Thread Charles-Axel Dein
Wow. You're amazing. Far clearer now. Thanks a lot! On Tue, Sep 11, 2012 at 5:27 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 11, 2012, at 11:09 AM, Charles-Axel Dein wrote: Ok great! Thanks for the doc fix. Ok also for Session.remove(), I must admit Session.remove() is one