I have searched the documentation but didn't find anything useful. Please
guide me in the right direction.
--
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.
my considers this
to be an unrecoverable error.
Note: I think the client app must enforce serialization of requests
if it wants a consistent worldview from its own actions.
We do have a `version` column in the Avatar table, but that's used to
handle concurrent/stale updates from two different de
s ({'%(4480418320 param)s': 37},)
params {}
query_params {u'param_1': None}
I've put some sample code up at
https://gist.github.com/georgevreilly/11f87d1d2f4664206df2
I'm using SQLAlchemy 0.9.9.
Is there a reliable way of capturing the actual query parameters?
--
/George V
On Fri, Sep 18, 2015 at 1:33 PM, Mike Bayer
wrote:
>
> On 9/18/15 3:22 PM, George Reilly wrote:
>
> I find [SQLTap](http://sqltap.inconshreveable.com/) invaluable for
> profiling SQLAlchemy queries. Currently, I've reduced one operation in our
> system from nearly 12,000
On Mon, Sep 28, 2015 at 1:04 AM, David Allouche wrote:
> On 28 Sep 2015, at 05:21, George V. Reilly
> wrote:
>
> SQLTap is a very useful library that helps you in profiling SQLAlchemy
> queries. It helps you understand where and when SQLAlchemy issues queries,
> how often th
On Sat, Oct 3, 2015 at 4:34 AM, David Allouche wrote:
> On 2 Oct 2015, at 05:49, George Reilly wrote:
>
> On Mon, Sep 28, 2015 at 1:04 AM, David Allouche
> wrote:
>
>> On 28 Sep 2015, at 05:21, George V. Reilly
>> wrote:
>>
>> SQLTap is a very use
e test case below.
Thanks,
George
#
from sqlalchemy import Column, Integer, String, ForeignKey, case
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm
On Wednesday, June 19, 2013 9:47:08 PM UTC+1, Michael Bayer wrote:
>
>
> On Jun 19, 2013, at 4:19 PM, George Sakkis >
> wrote:
>
> > It seems that hybrid properties are not allowed to be specified as
> strings for the order_by parameter of a relationship;
tioned explicitly in the docs and
can't put my finger on it.
Any insight would be appreciated.
Thanks,
George
--
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
On Tuesday, August 13, 2013 12:59:57 AM UTC+3, Ams Fwd wrote:
>
> On 08/12/2013 02:50 PM, George Sakkis wrote:
> > Hello everyone,
> >
> > this is more of a code architecture and design question but I'm
> > wondering what the best practices are regarding
lambda session: email_user(new_user.email, "welcome
{}!".format(new_user.name))
Thanks,
George
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from i
On Monday, 25 November 2013 17:27:02 UTC+2, Michael Bayer wrote:
>
>
> On Nov 25, 2013, at 9:00 AM, George Sakkis >
> wrote:
>
> > Hi all,
> >
> > is there a feature or pattern for adding a listener that is to be
> executed (at most) once? For exam
erson()
person.name = p['name']
session.add(person)
session.flush()
ap = AppointmentPerson(appointment_id=appt.id, person_id=
person.id)
session.add(ap)
# update rel1 and rel2
This isn't especially efficent and leads
has no effect.
- What is the difference between the two?
- How can an instance be dissociated from the session?
- Is a (False, True) combination possible and if yes how?
Thanks,
George
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To
On Thursday, 24 July 2014 21:56:11 UTC+3, Michael Bayer wrote:
>
>
> expunge() is a bug:
>
>
> https://bitbucket.org/zzzeek/sqlalchemy/issue/3139/expunge-after-delete-fails
>
> it’s supposed to raise (hence can’t fix this til 1.0).
>
> so ignore expunge. if you were to emit session.rollback(), y
Thanks Michael, that gives me more understanding of using the session.
Actually the DBSession is initialized from:
DBSession = scoped_session(sessionmaker(
extension=ZopeTransactionExtension()))
as the following description:
ZopeTransactionExtension is a little piec
Thanks Michael, that solves my problem.
On Mon, Sep 12, 2011 at 3:18 PM, Michael Bayer wrote:
>
> On Sep 12, 2011, at 5:50 PM, Geo wrote:
>
> > I have a tested update ... from.. statement, like so:
>
> UPDATE...FROM syntax, which is non-standard, isn't built into SQLAlchemy
> right now. You'
thing or is it a regression?
Thanks,
George
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroup
s not deterministic?
Thanks!
George
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
F
On Oct 2, 10:39 pm, Michael Bayer wrote:
> On Oct 2, 2012, at 4:29 PM, George Sakkis wrote:
>
> > I had the impression that the Session’s unit of work figures out
> > automatically the potential object dependencies and makes sure that
> > the insertion order is consiste
synchronize_session='evaluate'
so, how this option really work?
On Saturday, February 4, 2012 10:47:13 AM UTC+8, Michael Bayer wrote:
On Feb 3, 2012, at 1:04 PM, Mason wrote:
> Hi,
>
> If i have a table named 'message' and it has the following columns:
> message_id, tar_del, src_del. I pass in
nning
SQLAlchemy on PyPY?
Thanks for any tip,
George
--
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...@googlegroups.com.
T
On Jan 30, 3:54 pm, Michael Bayer wrote:
> On Jan 30, 2013, at 5:43 AM, George Sakkis wrote:
>
> > Hello,
>
> > I am in the process of migrating to PyPy and have a handful of unit test
> > failing due to the different garbage collector and SQLAlchemy's usag
On Jan 31, 5:52 pm, Michael Bayer wrote:
> This issue seems vaguely familiar and I feel like I would have done something
> about it when it was reportedah this is #2583. It's fixed in 0.7.10
> (if/when I release that) and is in all released 0.8 versions as well.
Great, that was it; it hasn
ur, ~170
rows/second. That's in a PostgreSQL database running with
synchronous_commit turned off and all foreign and unique constraints
dropped during the bulk load.
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
join() figure out the join condition, and is there a way
to make it work without having to pass it explicitly every time ?
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post t
On Jun 1, 3:34 pm, "Michael Bayer" wrote:
> George Sakkis wrote:
>
> > I'm trying to use the primaryjoin/foreign_keys parameters (http://
> >www.sqlalchemy.org/docs/05/mappers.html#specifying-foreign-keys) to
> > specify a relation between tables that d
t the docs or at least a recipe on the wiki
since apparently it's not obvious at all. Below are some of my failed
attempts; any help will be very much appreciated.
George
#
from sqlalchemy.orm import relation, sessionmaker
from sqlalchemy.
o-many relations by hiding the
association object and it requires a regular relation to be defined
anyway. In my example there are two independent one-to-many
relationships and the intermediate table (User) is not just an
association object, it's a standalone object.
George
> On Mon, Jun
stable and robust this is.
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send
Thanks, didn't know that, though in this case I want the keys in the
same column order but keys() doesn't preserve it.
George
On Jun 3, 8:59 pm, Michael Bayer wrote:
> each row has a keys() attribute if that helps...
>
> On Jun 3, 2009, at 8:49 PM, George Sakkis wrote:
&
On Jun 4, 5:09 am, "King Simon-NFHD78"
wrote:
> George Sakkis wrote:
>
> > Is there a (public) API for getting the column names of a given Query
> > instance and other similar introspection needs ? I didn't find
> > anything related in the docs but after
e I'll probably rewrite my_proc in
sqlalchemy, which may not be that bad after all, but I'd rather avoid
this if possible.
Thanks,
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy&quo
#x27;s pretty cool, too bad I can't use it for MySQL. Nevermind, I
rewrote the stored proc using sqlalchemy and numarray to do the heavy
number crunching and I'm happy with the result. Not only is the code
shorter, but it's at least as fast as before !
George
--~--~-
reason why there's not a __len__ that returnes this rowcount ?
Thanks,
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroup
child to parent (as
above), but apparently the latter doesn't seem to work. Is this the
case or something else is wrong ?
George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
s above), but apparently the latter doesn't seem to work. Is this
> > the case or something else is wrong ?
>
> > George
It's one2many from Ranker to Result.
class Ranker(Entity):
has_many('results', of_kind='Result', cascade='all, delete-
orph
Hi,
first of all, thanks for SQLAlchemy - it's the one project that actually
made me enjoy working with large data collections in applications ;)!
I have an SQLAlchemy model that associates tags (key/value pairs) with
elements, like in attached mwe.py.
Element.tags is a dictionary collection,
to work-around it for now?
I would probably go with monkey-patching SQLAlchemy at runtime and I am afraid
Python would actually allow that.
Or is there another simple way of getting that kind of query?
-nik
--
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296
Dominik George
Hi,
Am Freitag, 12. August 2016 11:12:37 UTC+2 schrieb Dominik George:
>
> I would probably go with monkey-patching SQLAlchemy at runtime and I am
> afraid Python would actually allow that.
>
>
>
Did it, and it actually works nicely:
https://github.com/Natureshadow/OSMA
clause got already compiled to a Selectable
and thus I cannot inspect it like I can the uncompiled query.
Any hints on how to achieve that?
Cheers,
Nik
--
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296
Dominik George · Mobil: +49-1520-1981389
Teckids e.V. · FrOSCon e.V
Hi,
Am Montag, 15. August 2016 15:32:35 UTC+2 schrieb Mike Bayer:
>
>
> nothing is string-compiled at that point, everything is just nested
> inside. the Exists() should have something like "element" inside of it
> (look in its __dict__) that is the underlying Selectable.
>
>
>
.element is a F
To be more precise:
I have a query like this one:
session.query(osmalchemy.node).filter(osmalchemy.node.tags.any(key="name",
value="Grill-Corner")).all()
It ultimately compiles to this QL expression:
query = SELECT osm_nodes.element_id AS osm_nodes_element_id,
osm_elements.element_id
AS osm_
C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296
Dominik George · Mobil: +49-1520-1981389
Teckids e.V. · FrOSCon e.V. · OpenRheinRuhr e.V.
Fellowship of the FSFE · Piratenpartei Deutschland
Opencaching Deutschland e.V. · Debian Contributor
LPIC-3 Linux Enterprise Professional (Security)
--
You
Hi,
thanks for your reply!
make sure you set the environment variable PYTHONHASHSEED=random, then
> run your tests repeatedly. This variable produces a random hash seed
> for dictionaries and will smoke out dictionary-ordering based bugs more
> clearly so that you can localize the source of i
om that happens inside SQLAlchemy.
Cheers,
Nik
--
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296
Dominik George · Mobil: +49-1520-1981389
Teckids e.V. · FrOSCon e.V. · OpenRheinRuhr e.V.
Fellowship of the FSFE · Piratenpartei Deutschland
Opencaching Deutschland e.V. · D
Hi Mike,
here it is. See attached mwe.py.
Test:
% for i in $(seq 1 10); do PYTHONHASHSEED=$i python3 mwe.py; done
foo = , bang =
foo = , bang =
foo = bar , bang = baz
foo = bar , bang = baz
foo = , bang =
foo = , bang =
foo = , bang =
foo = bar , bang = baz
foo = , bang =
foo = , ba
Am Samstag, 10. September 2016 09:02:32 UTC+2 schrieb Dominik George:
>
> Hi Mike,
>
> here it is. See attached mwe.py.
>
Which is here ;).
-nik
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe
Hi Mike,
thank you so much for this insight into your way of tracing this, and for
the provided work-around (which I could really have come up with myself…).
3. next I want to whack the monkeypatched thing, because that's a lot of
> code that I don't want to be involved in the issue. Fortunate
I noticed some strange behavior while using the SQLAlchemy expression
language. I'm using Python 3.5 and SQLAlchemy 1.1.19 against MySQL 5.7.13
via the mysqlclient v1.3.10 connector.
The problem happens when I build up a boolean expression using and_() /
or_(), then give that expression a name
Thank you for your reply Jonathan. I tried your suggestion and tested the
effect of adding .compile statements. I think it provides some insight into
my point #2, i.e. different results when I run the literal bound query vs.
when I run the unbound expression. Point #1, i.e. the lack of parentheses
Hello.
My angular is using a datepicker to send a date in string format(ex:
2018-09-11) to my flask app to postgres via sqlalchemy.
In my postgres all rows have a column ef_time of timestamps type.(ex:
2018-09-07
13:24:30.138)
@app.route('/orders/')
def get_orders(ide):
session = Session()
or
Thank you! You eliberated me to finally move to the next step in my
project, this kept me at a standstill.
Thank you !
marți, 11 septembrie 2018, 12:59:18 UTC+3, Simon King a scris:
>
> On Tue, Sep 11, 2018 at 9:39 AM George Brande > wrote:
> >
> > Hello.
> >
On Saturday, September 19, 2015 at 8:14:31 AM UTC-7, Michael Bayer wrote:
>
>
>
> On 9/18/15 7:58 PM, George Reilly wrote:
>
>
> Thanks for the prompt answer. I tried after_cursor_execute, but it didn't
> really help as I just got a tuple of the values, without a c
SQLTap is a very useful library that helps you in profiling SQLAlchemy
queries. It helps you understand where and when SQLAlchemy issues queries,
how often they are issued, how many rows are returned, and if you are
issuing queries with duplicate parameters. The last two are new in
tonight's 0.
I've spent time unsuccessfully trying to fix some problems with a
many-to-many table
and lazy joins.
Here's a simplified repro:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Integer
I've spent time unsuccessfully trying to fix some problems
with a many-to-many relationship and lazy joins.
Here's a simplified repro:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, I
Thanks! I went with
Appointment.persons = relationship(
'AppointmentPerson',
cascade='delete-orphan, delete, save-update, merge, expunge',
lazy=LAZYJOIN)
and used the slice notation to empty the InstrumentedList:
appt.persons[:] = []
In my real app, I spent som
Is there such a thing as SQLAlchemy training or a SA consultant? I'm
starting to think that my team might benefit from some time with
someone who really knows their stuff.
/George Reilly, Seattle
--
You received this message because you are subscribed to the Google Groups
"sqlalch
I attended this year's MySQL Conference and generally found it
worthwhile. One big disappointment: there was very little coverage of
interacting with MySQL from Python, Ruby, or other programming
languages.
A session on SQLAlchemy would be great.
http://en.oreilly.com/mysql2011/public/cfp/126
--
explain query plans and the like, to understand
performance issues.
I specifically care about MySQL and SQLite queries.
/George Reilly, Seattle
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@goog
The combination of create_engine(..., echo=True) and
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('sqlalchemy').setLevel(logging.DEBUG)
does the trick for me now.
Thanks!
/George
--
You received this message because you are subscribed to the Google Groups
"sq
We ran into a nasty problem with sharding a while back. We came up with an
effective workaround, but we don't fully understand the problem. Perhaps
someone here can provide more insight.
We shard requests to our production MySQL databases using
sqlalchemy.ext.horizontal_shard.ShardedSession. Ou
On Sunday, March 11, 2012 10:56:44 PM UTC-7, Michael Bayer wrote:
>
>
> On Mar 11, 2012, at 8:03 PM, George V. Reilly wrote:
>
> > We ran into a nasty problem with sharding a while back. We came up with
> an effective workaround, but we don't fully understand the p
list_item_id = :param_2
and :param1 is of the form _BindParamClause(u'%(63636624 param)s',
None, type_=UUID())
Typically, I'm seeing this come out of the innards of SQLAlchemy,
as one of several queries triggered by, say, a session.merge().
How do we work around this?
Thanks!
/Georg
On Mar 30, 4:42 pm, "Michael Bayer" wrote:
> George V. Reilly wrote:
> > We're using SQLAlchemy sharding to partition accounts across a couple
> > of databases. We want to add more partitions, but first we need to
> > eliminate some unnecessary cross-partit
Michael Bayer wrote:
> check out r0ddd638f1d90 in mercurial. I've added the function from the
> example below, plus support for in_op(), to the attribute_shard example.
> The old ClauseVisitor method is removed and replaced with this more robust
> method.
Very nice! Thanks,
On Apr 2, 4:43 pm, "George V. Reilly"
wrote:
> Michael Bayer wrote:
> > check out r0ddd638f1d90 in mercurial. I've added the function from the
> > example below, plus support for in_op(), to the attribute_shard example.
> > The old ClauseVisitor method is
has a /* comment */ inserted by my code.
/George V. Reilly, Seattle
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqla
Our production database uses MySQL. For various reasons, the schema
often uses MySQL-specific DDL. We want that represented in our
mapper classes. We also awant to be able to exercise our SQLAlchemy
unit tests against both local MySQL databases and SQLite databases.
Using the MySQL-specific types
Thanks, Michael.
On May 6, 7:48 am, Michael Bayer wrote:
> On May 6, 2010, at 3:35 AM, George V. Reilly wrote:
>
> > Our production database uses MySQL. For various reasons, the schema
> > often uses MySQL-specific DDL. We want that represented in our
> > mapper classes.
that are hardly ever
modified—and not at all while the Alembic migrations were executing.
However, many of our most frequent SELECTs JOIN to these tables, so they're
constantly being read from.
Aside, from making a planned outage, do we have any good options?
Thanks!
/George Reilly
--
SQL
ixed SQL script, test it on
> a staging database first, then run in production.
>
> then again, the ALTER will probably be extremely quick if you can in
> fact pause the load for a few minutes, since you are defaulting to
> NULL.
>
> On Tue, Jan 16, 2018 at 3:42 PM, Georg
73 matches
Mail list logo