[sqlalchemy] Security Implications of Directly Executing Queries Compiled to Strings

2019-03-07 Thread Seth P
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

Re: [sqlalchemy] Re: ORM: read from view but write into separate table

2018-12-05 Thread Seth P
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

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-01 Thread Seth P
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

[sqlalchemy] SQLAlchemy and Python 3.7 data classes

2018-02-28 Thread Seth P
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

[sqlalchemy] Re: SQLAlchemy 1.2.0 released

2018-01-03 Thread Seth P
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,

[sqlalchemy] Postgres 10 identity keyword

2017-10-08 Thread Seth P
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,

[sqlalchemy] Re: DELETE CASCADE does not work when foreing key can be nulleable

2017-07-21 Thread Seth P
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

Re: [sqlalchemy] quote=False for all columns in table

2017-07-01 Thread Seth P
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 =

Re: [sqlalchemy] quote=False for all columns in table

2017-06-30 Thread Seth P
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

[sqlalchemy] quote=False for all columns in table

2017-06-30 Thread Seth P
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

Re: [sqlalchemy] ORM and table with no primary key

2016-10-17 Thread Seth P
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

[sqlalchemy] ORM and table with no primary key

2016-10-17 Thread Seth P
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

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
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 >

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
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

Re: [sqlalchemy] Sequence schema

2016-10-17 Thread Seth P
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

[sqlalchemy] Sequence schema

2016-10-14 Thread Seth P
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

Re: [sqlalchemy] Feedback appreciated

2016-10-03 Thread Seth P
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

Re: [sqlalchemy] Feedback appreciated

2016-10-03 Thread Seth P
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

Re: [sqlalchemy] Feedback appreciated

2016-09-30 Thread Seth P
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

Re: [sqlalchemy] Feedback appreciated

2016-09-28 Thread Seth P
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 >

Re: [sqlalchemy] Feedback appreciated

2016-09-28 Thread Seth P
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

[sqlalchemy] Re: SQLAlchemy - Bulk update using sqlalchemy core table.update() expects all columns in the values data

2016-09-28 Thread Seth P
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

Re: [sqlalchemy] Feedback appreciated

2016-09-28 Thread Seth P
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.

[sqlalchemy] Re: SQLAlchemy - Bulk update using sqlalchemy core table.update() expects all columns in the values data

2016-09-28 Thread Seth P
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

Re: [sqlalchemy] How to bulk-insert millions of values into Oracle

2016-09-26 Thread Seth P
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

[sqlalchemy] How to bulk-insert millions of values into Oracle

2016-09-23 Thread Seth P
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

[sqlalchemy] sa.DateTime(timezone=True) not emitting TIMESTAMP WITH TIMEZONE for Oracle

2016-09-22 Thread Seth P
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

Re: [sqlalchemy] Using literals in ORM update/delete query

2016-09-13 Thread Seth P
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

[sqlalchemy] kdb+/q dialect

2016-09-08 Thread Seth P
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

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Seth P
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?

Re: [sqlalchemy] Column order with declarative base and @declared_attr

2016-08-25 Thread Seth P
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

Re: [sqlalchemy] Implicit join condition

2016-07-13 Thread Seth P
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

Re: [sqlalchemy] Implicit join condition

2016-07-13 Thread Seth P
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

[sqlalchemy] Re: Implicit join condition

2016-07-13 Thread Seth P
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

[sqlalchemy] Implicit join condition

2016-07-13 Thread Seth P
[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

[sqlalchemy] Implicit join conditions

2016-07-12 Thread Seth P
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

Re: [sqlalchemy] How does one build a self referential many-to-many relationship query that includes an additional join table column in the result?

2014-12-06 Thread Seth
Got it, thanks! -- 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. To post to this group, send email to

[sqlalchemy] How does one build a self referential many-to-many relationship query that includes an additional join table column in the result?

2014-12-04 Thread Seth
this properly. Thanks in advance, Seth -- 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. To post to this group, send email

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-14 Thread Seth
Thanks Mike, But...is there no way to set this behavior directly on the relationship()? The whole point there is to be lazy ;) Seth On Saturday, May 10, 2014 7:59:33 PM UTC-7, Michael Bayer wrote: session.query(Parent).options(defaultload(“children”).load_only(“cheap_column)) or really

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-14 Thread Seth
relationship without the specific call within the query().So unless you maybe ran those options into every Query unconditionally, or something. I’d look to see how big a deal it is to just be explicit on this one. On May 14, 2014, at 1:39 PM, Seth seediff...@gmail.com javascript: wrote

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-13 Thread Seth P
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

[sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
be virtually instantaneous. Any thoughts? Thanks, Seth import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base import time engine = sa.create_engine('mssql+pyodbc://Compustat/Compustat') session = sessionmaker(bind=engine

[sqlalchemy] Re: engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
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

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
://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

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
, 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

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
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

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
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

Re: [sqlalchemy] engine.execute() slow with parameterized queries?

2014-05-12 Thread Seth P
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

[sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-10 Thread Seth
and not it's expensive_column. Thanks, Seth -- 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. To post to this group, send email

[sqlalchemy] Problem with _compiler_dispatch() call?

2014-05-05 Thread Seth P
is not provided in the type_._compiler_dispatch() call from TypeCompiler.process() in line 266 of compiler.py. The end of the traceback is below. I'm using SQLAlchemy 0.9.4, Python 3.4.0, and alchy 0.11.2. Thanks, Seth ... C:\Python34\lib\site-packages\sqlalchemy\sql\visitors.py

[sqlalchemy] Re: Problem with _compiler_dispatch() call?

2014-05-05 Thread Seth P
Of course you are right. My problem code was basically the PythonEnum class in https://groups.google.com/d/topic/sqlalchemy/5yvdhl9ErMo/discussion. Deleting the *(m.name for m in enum_class), from the __init__ call seems to have fixed the problem. Thanks again. Seth On Monday, May 5, 2014 3

[sqlalchemy] How to order a many-to-many association_proxy?

2014-02-27 Thread Seth P
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

[sqlalchemy] Re: How to order a many-to-many association_proxy?

2014-02-27 Thread Seth P
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

[sqlalchemy] How to order many-to-many association_proxy?

2014-02-27 Thread Seth P
' object has no attribute 'order'. Is it possible to somehow specify order_by so that the a.bs are automatically sorted by b.order? Thanks! Seth from sqlalchemy import Column, Integer, ForeignKey, create_engine from sqlalchemy.orm import create_session, relationship, backref from

Re: [sqlalchemy] How to order a many-to-many association_proxy?

2014-02-27 Thread Seth P
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

Re: [sqlalchemy] How to order a many-to-many association_proxy?

2014-02-27 Thread Seth P
, 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

[sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Seth P
session.commit() # UPDATE session.close() Thanks, Seth -- 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. To post

Re: [sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Seth P
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

[sqlalchemy] overriding lazy loading?

2013-09-12 Thread Seth P
know I won't be accessing the related objects, I'd much rather load with lazy='select' (so as not to load the related objects). Is this possible? Thanks, Seth -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop

Re: [sqlalchemy] overriding lazy loading?

2013-09-12 Thread Seth P
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

[sqlalchemy] joined-table inheritance and ambiguous foreign keys

2013-07-24 Thread Seth P
'; tables have more than one foreign key constraint relationship between them. Please specify the 'onclause' of this join explicitly. Thanks, Seth -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving

Re: [sqlalchemy] joined-table inheritance and ambiguous foreign keys

2013-07-24 Thread Seth P
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

[sqlalchemy] Versioned mixin and backref

2013-06-19 Thread Seth P
that favors the current behavior? Thanks, Seth from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.ext.declarative.api import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session, relationship, backref from history_meta import VersionedMixin

[sqlalchemy] Bug in query with multiple joins when using joined inheritance?

2013-06-14 Thread Seth P
) result, [u'BBB']. Is this a bug, or is the query malformed? In the second query, adding a seemingly gratuitous join with D fixes the problem. And as the third query shows, replacing C by an aliased version also fixes the problem. So whatever is going on seems rather subtle. Thanks, Seth from

[sqlalchemy] Re: new sqlalchemy user having problems to insert...

2010-01-06 Thread seth
Yesterday I managed to get working all my 1 to 1 inserts. I was only missing the following properties on the child and parent classes: parent = Parent() child = Child() parent.child=child child.parent=parent -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: new sqlalchemy user having problems to insert...

2010-01-05 Thread seth
Hi Mike, Thanks for your email. You are right. And actually, I read that article two months ago and keeps coming back to me like haunting. Does not matter how many python books I have, it is just so easy to say but so hard to migrate my mind to python. Anyway, I'll keep trying. I still want to say

[sqlalchemy] Re: new sqlalchemy user having problems to insert...

2010-01-05 Thread seth
Hey, I fixed problem #1. Since I am not the first java - spring - hibernate developer migrating to the python wold, nor the last..., here goes what I learned from this: Object properties cannot be private (cannot start with _ or __ ) for SQLAlchemy to find them. I do not know the exceptions to

[sqlalchemy] Re: new sqlalchemy user having problems to insert...

2010-01-04 Thread seth
Hi Mike, Thank you very much for replying to my post. I really appreciate it. I agree that the init of the classes may have something to do with the problem. Maybe the way we are defining the attributes does not allow to SQLAlchemy table wrappers to view the attributes' values? What confuses me

[sqlalchemy] Re: new sqlalchemy user having problems to insert...

2010-01-04 Thread seth
Here goes the variables' parent class #=== # Variable quantities with units # Written by Konrad Hinsen hin...@cnrs-orleans.fr # with contributions from Greg Ward # last revision: 2007-5-25 # Revised for SIAM-PFM by Paul

[sqlalchemy] new sqlalchemy user having problems to insert...

2009-12-30 Thread seth
Hi, I've worked with hibernate many years on java projects. But, I am new using SQLAlchemy. I am very impressed with the capabilities and the excellent documentation. It really seems very powerful. Our new project is being written in python -of course. And we are using MySQL as well. I've a

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
discussion_comments) ...but this is still strange with the added enclosing parenthesis. I'm very sorry to keep belaboring this issue here, but I'm doing a SQL optimization sweep on my code and this query is tripping me up. Thanks, Seth On Sep 8, 6:01 pm, Michael Bayer mike...@zzzcomputing.com wrote

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
Michael, This is not valid SQL being outputted (at least on SQLite MySQL). There should not be a parenthesis between the first UNION and SELECT. This causes an SQL error. Is there a way to reformat the query to get valid SQL? Thanks, Seth On Sep 9, 8:38 am, Michael Bayer mike

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
, user_id FROM t2 UNION SELECT post_id, user_id FROM t3 I have still not been able to get this query working correctly. Thanks, Seth On Sep 9, 10:34 am, Michael Bayer mike...@zzzcomputing.com wrote: Seth wrote: Michael, This is not valid SQL being outputted (at least on SQLite MySQL

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION [SOLVED]

2009-09-09 Thread Seth
apologize for taking up so much of your time. Thanks again, Seth On Sep 9, 12:26 pm, Michael Bayer mike...@zzzcomputing.com wrote: again I apologize for the misunderstanding and I hope this helps with your issue. - mike --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: Somewhat complex union_all() question

2009-09-09 Thread Seth
.created, P3.updated) subquery = DBSession.query().from_statement(union_all(q1, q2, q3)).subquery() posts = DBSession.query(subquery, User.name).filter (User.user_id==subquery.c.user_id) Kind of hackish, but... it seems to work? Seth On Aug 28, 12:07 pm, Mike Conley mconl...@gmail.com wrote

[sqlalchemy] Problems with NOT IN and layered subqueries

2009-09-08 Thread Seth
However, I can't get SQLAlchemy to replicate the NOT IN (SELECT ...) subquery setup. It strips the parenthesis after the NOT IN and so I get a syntax error. Advice would be appreciated! Seth --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: Problems with NOT IN and layered subqueries

2009-09-08 Thread Seth
Thank you Michael, What about using this type of thing inside another query? I keep getting: AttributeError: 'Select' object has no attribute '_nested_statement' Seth On Sep 8, 7:16 am, Michael Bayer mike...@zzzcomputing.com wrote: an example of NOT IN (subquery): from sqlalchemy

[sqlalchemy] Re: Problems with NOT IN and layered subqueries

2009-09-08 Thread Seth
UNION SELECT post_id, user_id FROM discussions UNION SELECT post_id, user_id FROM discussion_comments Thanks again, Seth On Sep 8, 2:38 pm, Michael Bayer mike...@zzzcomputing.com wrote: Seth wrote: Thank you Michael, What about using this type of thing inside another query? I keep

[sqlalchemy] Re: Somewhat complex union_all() question

2009-08-28 Thread Seth
).filter(P2.user_id==User.id) q3 = DBSession.query(P3.id, P3.user_id, 'P3', P3.title, P3.body, P3.created, P3.updated, User.name).filter(P3.user_id==User.id) posts = q1.union_all(q2, q3) ? Seth On Aug 27, 2:45 pm, Mike Conley mconl...@gmail.com wrote: OK, I can mostly answer my own question q1

[sqlalchemy] Re: Somewhat complex union_all() question

2009-08-27 Thread Seth
Mike, Very helpful! Seems to work great. Wanna give me a tip on how to make the user's table join to this query via the user_id so that I can access the user's information at something like q.user.email? Seth On Aug 26, 9:22 pm, Mike Conley mconl...@gmail.com wrote: or should be a little

[sqlalchemy] Somewhat complex union_all() question

2009-08-26 Thread Seth
the ArgumentError? Thanks, Seth --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Relation with distinct

2009-08-25 Thread Seth
='posts') comments = relation('Comments') How would you apply your suggested mapper() call to this type of setup? Or do I need to switch things to the more traditional approach? Thanks, Seth On Aug 25, 9:45 am, Michael Bayer mike...@zzzcomputing.com wrote: use a recipe almost identical