Hi,
I just noticed an oddity using the TimezoneType as a column type. Suppose
the following statement:
conn.execute(t_user.update() \
.where(t_user.c.id == id_) \
.values({
'timezone': pytz.timezone(tzname),
}))
To clarify on my post just now:
My problem was that I did
with scoped_session() as session:
# setup stuff
with pytest.raises(IntegrityError):
session.add(entity)
session.commit() # This should be inside the raises context.
So the syntax in the orignal post here is actual
you can use multiple types, but the question is if you want to *load*
multiple subtypes *at the same time* while not loading othersif
you need to load sub-groups of subtypes all at once then
AbstractConcreteBase is going to create lots of problems for you and
it probably can't handle this use c
Examining the stacktrace more closely revealed that I made the mistake of
checking for the error on the add but left the context of that error check
before committing. I actually did it the correct way in my all my other
tests so I'm not sure why I made the mistake at the very end.
My apologies
I dont plan to use just one type.
Your example queries worked for me, but I have a few more doubts.
How can I :
- Perform filter on a particular sub type ? E.g. I want the
OrderTestItem to have only those that are newer than x date
- Load just few sub types ? If i had 10 different
On Wed, Mar 7, 2018 at 5:46 PM, Erol Merdanović wrote:
> I don't think the problem is with database, because sometimes I have to
> restart the application (flask running as uwsgi) to make it work.
that is exactly the symptom that your database has been restarted or
that the network connections be
if you only need to load against one sub-type at a time, then you
shouldn't use any polymorphic features or concrete inheritance. Make
your OrderItem just a non-mapped mixin class, then OrderItemTest and
whatever else are just normal mapped-to-one-table classes.
On Wed, Mar 7, 2018 at 5:39 PM, Mi
I don't think the problem is with database, because sometimes I have to
restart the application (flask running as uwsgi) to make it work.
There is no error page but default flask error page (it's running in debug
= False mode / production mode, so error is just 500 response with no
content). I
On Wed, Mar 7, 2018 at 4:19 PM, Harshvardhan Gupta
wrote:
> Calling configure_mappers() fixes the issue.
>
> However, the next thing I tried was to do joined load ( for eager loading )
> , and it fails.
>
> This is what I tried :
>
>
> order =
> db.session.query(Order).join(Order.items.of_type(or
Calling configure_mappers() fixes the issue.
However, the next thing I tried was to do joined load ( for eager loading )
, and it fails.
This is what I tried :
order = db.session.query(Order).join(Order.items.of_type(order_items)).
options(joinedload(Order.items.of_type(order_items))).all(
my test doesn't have that problem, try calling configure_mappers()
first. Try running the test case I have as given.
On Wed, Mar 7, 2018 at 4:02 PM, Harshvardhan Gupta
wrote:
> Thanks for the reply.
>
> Sorry, I will be more careful when i sent code snippets.
>
> I tried this out after you aske
Thanks for the reply.
Sorry, I will be more careful when i sent code snippets.
I tried this out after you asked me to remove flat =True, so the code looks
like this now :
pjoin = polymorphic_union({
'order_test_item': OrderTestItem.__table__,
}, 'type', 'pjoin') # I dont think 'type
found a few mentions of "flat=True" that fail to specify that this
flag should **not** be used when selectable= is set, pushing extra
verbiage to that effect now. most likely with_polymorphic() should
raise an error if both flags are set.
On Wed, Mar 7, 2018 at 3:48 PM, Mike Bayer wrote:
> here
here's a full MCVE, which with "flat=True" reproduces your issue
exactly (send me this next time). The issue is the "flat=True", take
that out because it isn't compatible with a concrete union - it
implies the "aliased" flag and that gets in the way of what the
polymorphic_union() function is doi
On Wed, Mar 7, 2018 at 11:30 AM, KCY wrote:
> In one of my tests I'm checking that a pair of (non primary) fields must be
> unique. This definition is done with:
>
> __table_args__ = (UniqueConstraint('entity_id', 'version',
> name='id_version_combined_unique'),)
>
> where `entity_id` is an INT co
Thanks for replying.
I forgot to show the error.
It is this:
1054, "Unknown column 'pjoin.order_id' in 'on clause'") [SQL: "SELECT
`order`.id AS order_id, `order`.rp_id AS order_rp_id, `order`.user_id AS
order_user_id \nFROM `order` INNER JOIN (SELECT order_test_item.order_id AS
order_id, or
On Wed, Mar 7, 2018 at 2:49 PM, Erol Merdanović wrote:
> Mike, thank you for the reply. Here is the stack trace
your application has encountered an error which caused it to
invalidate the connection, such as the database was restarted or the
connection was lost. Then it failed to handle the err
On Wed, Mar 7, 2018 at 11:09 AM, wrote:
> Thanks for taking the time to answer my ignorant remark, I hadn't the full
> history on this question.
>
>
> Le mercredi 7 mars 2018 15:12:34 UTC+1, Mike Bayer a écrit :
>>
>> it is quite inconsistent. But that's where we are - SQL doesn't
>> support emp
On Tue, Mar 6, 2018 at 8:36 PM, Harshvardhan Gupta
wrote:
> I tried to use AbstractConcreteBase for polymorphic relationships , but I am
> getting errors. The examples in sqlalchemy cover normal polymorphism well,
> but not those with Abstract Base classes.
>
>
> I have already asked a question on
Mike, thank you for the reply. Here is the stack trace
AttributeError: 'Connection' object has no attribute
'_Connection__connection'
File "sqlalchemy/engine/base.py", line 1112, in _execute_context
conn = self.__connection
InvalidRequestError: Can't reconnect until invalid transaction is r
In one of my tests I'm checking that a pair of (non primary) fields must be
unique. This definition is done with:
__table_args__ = (UniqueConstraint('entity_id', 'version', name=
'id_version_combined_unique'),)
where `entity_id` is an INT column referring to a foreign id and version is
a plain
More crazy DUAL :
MariaDB [(none)]> SELECT 2 IN (SELECT 1 from DUAL WHERE 1 != 1);
++
| 2 IN (SELECT 1 from DUAL WHERE 1 != 1) |
++
| 0 |
+
Thanks for taking the time to answer my ignorant remark, I hadn't the full
history on this question.
Le mercredi 7 mars 2018 15:12:34 UTC+1, Mike Bayer a écrit :
>
> it is quite inconsistent. But that's where we are - SQL doesn't
> support empty "IN" and "expanding IN" only does a search and r
there's also the NULL issue with this one:
psql (9.6.7)
test=# SELECT NULL in (SELECT 1 WHERE 1!=1);
?column?
--
f
(1 row)
vs.
MariaDB [(none)]> SELECT NULL IN (SELECT 1 FROM DUAL WHERE 1!=1);
+-+
| NULL IN (SELECT 1 FROM DUAL WHERE 1!=1) |
+---
On Wed, Mar 7, 2018 at 8:20 AM, wrote:
> For example "select 1 where false" returns and empty list and this works on
> at least postgres
oh ok, yes there's this also. This returns different results on
MySQL vs. Postgresql:
psql (9.6.7)
Type "help" for help.
test=# SELECT 1 in (SELECT 1 WHERE
On Wed, Mar 7, 2018 at 8:20 AM, wrote:
> Hello everyone,
>
> While toying around with the cool new features of 1.2, I noticed that the
> expanding of a bindparam in a "in" doesn't accept empty list.
>
> This is documented, and the error message is pretty clear, but the behavior
> itself is pretty
SQLAlchemy generates this error for a good reason, however it is less
typical when using the ORM Session.Would need at least a stack
trace to have any idea what is happening for you.
On Wed, Mar 7, 2018 at 7:31 AM, Erol Merdanović wrote:
> Hello
>
> I'm using latest sqlalchemy (this was also
Hello everyone,
While toying around with the cool new features of 1.2, I noticed that the
expanding of a bindparam in a "in" doesn't accept empty list.
This is documented, and the error message is pretty clear, but the behavior
itself is pretty inconsistent with the other "in" syntax :
from sq
Hello
I'm using latest sqlalchemy (this was also occurring with 1.1.x branch)
with flask and flask-sqlalchemy. For some reason I'm randomly getting this
error.
1. Checking the group there were similar problems but some mentioned that
problem is with database going away
2. Others mentioned tha
29 matches
Mail list logo