Someone wrote a server that blindly executes SQL strings? Oy. Google around for
why that is a terrible idea.
--
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
My 2c about table design (not SQLA): I would suggest having a child with
just id, a parent table with just id and child_id (foreign key to
child.id), and then store additional "versioned" data in separate
parent_history and child_history tables that have foreign keys only to
their respective
In relationship(), foreign_keys refers to the field in the source table,
not the destination.
--
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
I don't have a well-formulated question, but reading PEP 557
(https://www.python.org/dev/peps/pep-0557/) made me wonder if SQLAlchemy
declarative models would/should in some way be Python 3.7 data classes.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
Perhaps this isn't the right place to ask, but do you know when
https://anaconda.org/conda-forge/sqlalchemy will be updated to 1.2.0?
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal,
Apologies if I missed something, but does SQLAlchemy (1.2.0?) support the new
Postgres 10 identity keyword
(https://blog.2ndquadrant.com/postgresql-10-identity-columns/)?
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code,
You're naming both tables 'parent_table'. Perhaps that is messing things up?
--
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
Perfect. Thank you!
On Friday, June 30, 2017 at 5:41:33 PM UTC-4, Mike Bayer wrote:
>
>
> from sqlalchemy import Column, String, Integer, create_engine
> from sqlalchemy.orm import Session
> from sqlalchemy.ext.declarative import declarative_base
> from sqlalchemy import event
>
> Base =
Jun 30, 2017 at 4:31 PM, Seth P <set...@outlook.com >
> wrote:
> > Is there a way (when using declarative) to specify that all the columns
> of a
> > table should use quote=False without specifying it explicitly for each
> > column?
>
> Easiest is just to call
Is there a way (when using declarative) to specify that all the columns of
a table should use quote=False without specifying it explicitly for each
column?
I've tried setting __table_args__ = { 'quote_schema': False, 'quote': False
}, but that just affects the schema and table name, not the
On Monday, October 17, 2016 at 3:58:36 PM UTC-4, Mike Bayer wrote:
>
> that error is there right now because we don't emit the "col IS NULL"
> SQL within that section of the persistence code.
>
> took me a long time to find the history on this because I thought it had
> been discussed but looks
I realize that the orm really wants/needs a table to have a primary key:
http://docs.sqlalchemy.org/en/rel_1_1/faq/ormconfiguration.html?#how-do-i-map-a-table-that-has-no-primary-key
Alas I have to deal with an existing table with no primary key. That said,
it does have a unique constraint on a
On Monday, October 17, 2016 at 11:24:43 AM UTC-4, Mike Bayer wrote:
>
> However, I don't see how the ordered attributes fixes anything in terms
> of mixins. If a mixin wants its columns at the beginning, or the end,
> all of that can be upended by the presence of other mixins and those
>
On a related note, is there something like after_create events for indexes
and sequences? There doesn't seem to be.
--
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
On Sunday, October 16, 2016 at 10:09:00 AM UTC-4, Mike Bayer wrote:
>
>
>
> The simplest way is probably to set the creation order of the column to
> be at the top:
>
> col = Column(...)
> col._creation_order = -10
Great. I will use _creation_order. Thanks.
By the way, in view of PEP 520
I have a mixin of the following form
class MyMixin(object):
idx = sa.Column(sa.Integer, sa.Sequence('idx_seq', schema=???,
optional=True), primary_key=True)
...
I would like the sequence to have the same schema as the table into which
MyMixin will be mixed. I realize I could make idx
ike...@zzzcomputing.com>
Sent: Monday, October 3, 2016 5:54 PM
Subject: Re: [sqlalchemy] Feedback appreciated
To: <sqlalchemy@googlegroups.com>
On 10/03/2016 05:21 PM, Seth P wrote:
>
>
> On Friday, September 30, 2016 at 7:09:09 PM UTC-4, Mike Bayer wrote:
>
> the bin
On Friday, September 30, 2016 at 7:09:09 PM UTC-4, Mike Bayer wrote:
>
> the bind_expression() hook is here to allow you to re-render the
> expression. assuming value-bound bindparam() objects (e.g. not like
> you'd get with an INSERT or UPDATE usually), the value should be present
> and you
On Thursday, September 29, 2016 at 9:45:24 AM UTC-4, Mike Bayer wrote:
>
> you can add your own types to do these things also, especially
> read-only, just make any subclass of UserDefinedType and apply whatever
> result-row handling is needed for how cx_Oracle is returning the data.
>
> The
On Wednesday, September 28, 2016 at 5:43:04 PM UTC-4, Mike Bayer wrote:
>
> looks incredibly difficult. I'm not really about to have the resources
> to work with a type that awkward anytime soon, unfortunately. If it
> could be made to be a drop-in for 1.1's ARRAY feature, that would be
>
On Wednesday, September 28, 2016 at 10:16:20 AM UTC-4, Mike Bayer wrote:
>
>
> So illustrating VARRAY round trip on cx_oracle is the first step.
>
It looks like cx_Oracle supports reading varrays, but supports writing them
only as column literals, not as bound parameters. The following code
Oops, I missed that this is an UPDATE rather than an INSERT. Setting the
missing columns to None probably isn't what you want.
On Wednesday, September 28, 2016 at 9:08:00 AM UTC-4, Seth P wrote:
>
> Can't you include the missing columns in your dictionary with None values?
>
--
You
On Friday, August 23, 2013 at 3:52:54 PM UTC-4, Konsta Vesterinen wrote:
>
>
>
> On Friday, August 23, 2013 1:52:41 AM UTC+3, Michael Bayer wrote:
>
>
>> 2. ScalarListType vs. Postgresql ARRAY ? same/better? should SLT use
>> ARRAY on a PG backend ?
>>
>
> Hmm I'm not sure about this yet.
Can't you include the missing columns in your dictionary with None values?
--
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
Thanks. I guess my confusion is that the example at
http://docs.sqlalchemy.org/en/latest/core/tutorial.html#executing-multiple-statements
uses an array of dictionaries, not of unlabeled tuples. Meanwhile I ended
up using Oracle's sqlldr, which seems to get the job done, though is much
more
The answer to this is probably RTFM, but I can't figure it out.
Suppose I have a declarative model of the form
class MyModel(Model):
idx = sa.Column(sa.Integer, primary_key=True)
c1 = sa.Column(sa.Float)
c2 = sa.Column(sa.Integer)
...
c10 = sa.Column(sa.Float)
And a list of
The documentation for DateTime,
http://docs.sqlalchemy.org/en/latest/core/type_basics.html?highlight=datetime#sqlalchemy.types.DateTime,
states
Parameters:*timezone* – boolean. If True, and supported by the backend,
will produce ‘TIMESTAMP WITH TIMEZONE’. For backends that don’t support
FWIW, this sounds similar to the problems you and I had (separately) a
couple of years ago:
https://groups.google.com/forum/#!topic/sqlalchemy/kv7BqWZr9KQ
https://groups.google.com/forum/#!topic/sqlalchemy/k_9ZGI-e85E
On Monday, September 12, 2016 at 5:39:37 PM UTC-4, Thierry Florac wrote:
>
> I
Has anyone written a SQLAlchemy dialect for kdb+/q? I realize q isn't
exactly SQL, but I figure if it's possible to write a dialect for Pandas
tables (https://bitbucket.org/zzzeek/calchipan) it should be possible to do
so for q.
--
You received this message because you are subscribed to the
order first. So it would be of
limited use for there to be an ordering under @declared_attr.
On 08/25/2016 02:46 PM, Seth P wrote:
> I was just bitten by this issue. Is it still the case that there is no way to
> specify the order of two columns declared in a mixin using @declared_attr?
I was just bitten by this issue. Is it still the case that there is no way to
specify the order of two columns declared in a mixin using @declared_attr?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop
that has a
(unique) ForeignKey to A.)
On Wednesday, July 13, 2016 at 2:06:55 PM UTC-4, Mike Bayer wrote:
>
>
>
> On 07/13/2016 01:04 PM, Seth P wrote:
> > Thank you, as always, for the quick and detailed response.
> >
> > With the join to the subquery that's o
to the function, i.e.
join_to_min_a(q,
field_to_join_to_A_id).
On Wednesday, July 13, 2016 at 12:16:52 PM UTC-4, Mike Bayer wrote:
>
>
>
> On 07/13/2016 02:29 AM, Seth P wrote:
> > [Apologies for posting an incomplete version of this post earlier.
> > Please ignore it.]
> >
&g
Actually, taking a closer look, the sql generated for query 5 doesn't look
correct (or at least not what I want), since it isn't joining max_a_id with
anything.
On Wednesday, July 13, 2016 at 2:29:34 AM UTC-4, Seth P wrote:
>
> [Apologies for posting an incomplete version of this post e
[Apologies for posting an incomplete version of this post earlier. Please
ignore it.]
If B has a ForeignKey (and relationship) to A (e.g. B.a_id -> A.id), then I
can write query(B.b_num).join(A) without specifying the condition, and
SQLAlchemy will figure out the join automatically. [See query
Apologies if this is documented and I missed it.
If B has a ForeignKey (and relationship) to A (e.g. B.a_id -> A.id), then I
can write query(B.b_num).join(A) without specifying the condition, and
SQLAlchemy will figure out the join automatically. [See query 0 in the code
below.]
It will
it to happen and how. It
likely would require some subclassing and possibly monkey patching.
On May 12, 2014, at 8:23 PM, Seth P spad...@gmail.com javascript:
wrote:
pymssql produces the same results as pyodbc. So it looks like a SQL Server
issue.
On Monday, May 12, 2014 8:06:08 PM UTC
After tracking down some extreme slowness in loading a one-to-many
relationship (e.g. myobject.foobars), I seem to have isolated the issue to
engine.execute() being much slower with parameterized queries than with
explicit queries. The following is actual code and output for loading
10,971
Forgot to mention that I'm running SQLAlchemy 0.9.4 on 64-bit Python 3.4.0
on Windows.
On Monday, May 12, 2014 3:48:44 PM UTC-4, Seth P wrote:
After tracking down some extreme slowness in loading a one-to-many
relationship (e.g. myobject.foobars), I seem to have isolated the issue
://stackoverflow.com/questions/1171166/how-can-i-profile-a-sqlalchemy-powered-application/1175677#1175677
On May 12, 2014, at 3:48 PM, Seth P spad...@gmail.com javascript:
wrote:
After tracking down some extreme slowness in loading a one-to-many
relationship (e.g. myobject.foobars), I seem
, parameterized_runtime))
On Monday, May 12, 2014 6:40:48 PM UTC-4, Michael Bayer wrote:
On May 12, 2014, at 6:33 PM, Seth P spad...@gmail.com javascript:
wrote:
Is it possible that the (primary key index (which is a composite index
that begins with gvkey, and is the only index on the table) isn't being
to plug in parameters client-side. I presume not trivial to add to
SQLAlchemy? I don't see such an option for pyodbc.
On Monday, May 12, 2014 7:09:08 PM UTC-4, Seth P wrote:
Yep, it's not a SQLAlchemy issue. The following code demonstrates the
problem with direct pyodbc access.
import pyodbc
Fair enough. I'll take a look at pymssql, though I suspect it may be a SQL
Server rather than a driver issue.
On Monday, May 12, 2014 7:50:03 PM UTC-4, Michael Bayer wrote:
On May 12, 2014, at 7:35 PM, Seth P spad...@gmail.com javascript:
wrote:
Looks like other people have encountered
pymssql produces the same results as pyodbc. So it looks like a SQL Server
issue.
On Monday, May 12, 2014 8:06:08 PM UTC-4, Seth P wrote:
Fair enough. I'll take a look at pymssql, though I suspect it may be a SQL
Server rather than a driver issue.
On Monday, May 12, 2014 7:50:03 PM UTC-4
I get the following error when trying to create_all() in a sqlite database:
TypeError: _compiler_dispatch() missing 1 required positional argument:
'visitor'
Looking at annotation.py and visitors.py, all instances of
_compiler_dispatch() do indeed appear to expect a 'visitor' argument, which
:07:50 PM UTC-4, Seth P wrote:
I get the following error when trying to create_all() in a sqlite database:
TypeError: _compiler_dispatch() missing 1 required positional argument:
'visitor'
Looking at annotation.py and visitors.py, all instances of
_compiler_dispatch() do indeed appear
Apologies if I'm missing this is the docs somewhere, but I can't figure it
out. Suppose I have a many-to-many relationship between A and B, and that
I'd like have the various B's that a particular A points to ordered by
B.ordinal (i.e. in the examples below, I'd like A.bs to be sorted to
Just noticed that I had a typo, where I wrote order_by=b.ordinal rather
than order_by=b.order. But changing it to order_by=b.order still gives:
AttributeError: 'RelationshipProperty' object has no attribute 'order'
--
You received this message because you are subscribed to the Google Groups
How do I get the objects pointed to by a many-to-many association proxy to
be sorted? In the example below, adding order_by=b.order to the backref()
produces AttributeError: 'RelationshipProperty' object has no attribute
'order', and adding order_by=b.order produces AttributeError: 'Table'
Thank you. This was very helpful.
One non-trivial thing that stumped me for a while is that if B is derived
from a B_base using joined-table inheritance, and the order variable is in
the base table B_base, then it seems one must include B_base explicitly --
as highlighted below.
from
, February 27, 2014 9:26:31 PM UTC-5, Michael Bayer wrote:
On Feb 27, 2014, at 9:23 PM, Seth P spad...@gmail.com javascript:
wrote:
Thank you. This was very helpful.
One non-trivial thing that stumped me for a while is that if B is derived
from a B_base using joined-table inheritance
I have an issue where, I believe due to floating-point representation
issues, reassigning the same value to a floating-point field causes
SQLAlchemy to think the value has been modified, and therefore emits a
gratuitous UPDATE. (This is particularly problematic when using the
versioning mixin,
problem, the recipe fixes if you just say this:
class InexactFloat(TypeDecorator):
impl = Float
def compare_values(self, x, y):
return bool(x == y)
On Nov 19, 2013, at 8:30 PM, Michael Bayer
mik...@zzzcomputing.comjavascript:
wrote:
On Nov 19, 2013, at 8:10 PM, Seth
Is it possible to override the default loading strategy of a relationship
at run-time? For example, I have a relationship that I almost always want
to load with lazy='subquery' -- and so I set that as the default loading
strategy in the relationship definition -- but in one instance, when I
D'oh! I did, though for some reason it didn't occur to me that I could
specify .override(lazyload('points')) to override the relationship's
default lazy='subquery'. Works like a charm. Thank you.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To
The code below produces the error message below. How do I tell SQLAlchemy
that the inheritance join condition should be b.id == a.id rather than
b.parent_a_id
== a.id? (I would think the primary_key=True could be a hint...) I can't
figure it out from the documentation.
class A(Base):
Thank you.
On Wed, Jul 24, 2013 at 5:51 PM, Michael Bayer mike...@zzzcomputing.comwrote:
its a mapper arg called inherit_condition: __mapper_args__ =
{inherit_condition: id==A.id}
On Jul 24, 2013, at 3:42 PM, Seth P spadow...@gmail.com wrote:
The code below produces the error message
The Versioned mixin described in
http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html#versioned-objects
(which I renamed VersionedMixin, but is otherwise the same) has what I
would consider an unintuitive and undesirable interaction with backref: if
C references A with a backref, adding a
I've encountered what I believe to be a bug in SQLAlchemy (versions 0.8.0
and 0.8.1) in a query that joins class/tables that use joined inheritance.
In the code below, I would expect the three queries to produce the same
output, namely [u'CCC'], but the first one gives a different (incorrect)
59 matches
Mail list logo