[sqlalchemy] Transforming SQL to SQLAlchemy

2015-07-26 Thread Dennis Ljungmark
Hello, all. I am trying to reshape the (somewhat tricky) SQL query below into something SQLAlchemy can generate, and I just hit a wall: This is the query: SELECT (c).csr_id, (c).not_before, (c).not_after FROM (SELECT (SELECT c FROM certificate c WHERE c.csr_id=csr.id ORDER BY c.not_after

[sqlalchemy] scalar() works with outerjoin()?

2015-02-01 Thread Dennis
Does scalar() work with outerjoin()? I have an outerjoin sql statement that will only return 1 row. I used scalar(), but then I could not get the column values of the 2nd table. I fixed it, but just wondering if scalar() and outerjoin() are not to be mixed in the same sql statement? -- You

Re: [sqlalchemy] scalar() works with outerjoin()?

2015-02-01 Thread Dennis Fogg
oh, I found the function: first() which seems to work fine with joined queries. On Mon, Feb 2, 2015 at 12:21 AM, Dennis dennisf...@gmail.com wrote: Does scalar() work with outerjoin()? I have an outerjoin sql statement that will only return 1 row. I used scalar(), but then I could not get

Re: [sqlalchemy] Re: django user (using django ORM) + sqlalchemy for other db tables

2013-09-10 Thread Dennis
Thanks for the advice -- your recommendations against this configuration were a surprise to me... It's making me rethink what I want (and how much I want it). I'll post this as a comment to the first stackoverflow question so others are made aware. On Monday, September 9, 2013 10:17:10 PM

[sqlalchemy] django user (using django ORM) + sqlalchemy for other db tables

2013-09-09 Thread Dennis
Any advice (or potential problems) with using sqlalchemy with the django framework but keeping the django user auth module? The django ORM would be used for the auth module (and its user table). SqlAlchemy ORM would be used for other tables and also to read (but not write) the django user

[sqlalchemy] Re: django user (using django ORM) + sqlalchemy for other db tables

2013-09-09 Thread Dennis
PS: from my google searching, the 2 references below (and their references) are really the only mention of this approach on the web! So, it would be great to get some definitive advice on this seemly reasonable approach. On Monday, September 9, 2013 6:04:23 PM UTC+8, Dennis wrote: Any

[sqlalchemy] mapper could not assemble primary key for table

2013-07-26 Thread Dennis Backhaus
I have following table: class Group(DeclarativeBase): Group definition Only the ``group_name`` column is required. __tablename__ = 'tg_group' id = Column(Integer, autoincrement=True, primary_key=True) group_name = Column(Unicode(16), unique=True, nullable=False)

[sqlalchemy] no server side cursors in SA 0.4.6?

2008-06-16 Thread Matthew Dennis
Using Postgres 8.3.1 Consider the following script. In SA 0.4.3 it works as intended. In SA 0.4.6, it does not. In particular, the time to get the resultset in 0.4.3 is sub-second. The time in 0.4.6 is about 20 seconds. Also, when running on 0.4.3 the memory consumption of the script is

[sqlalchemy] transactional sessions not transactional?

2008-05-18 Thread Matthew Dennis
The following test case of mine fails on PG 8.3 and SA 0.4.3 Basically, create two sessions, make some changes in the first and obverse they are visible before commit/rollback in the second (and via connectionless execution directly on the engine), but become unvisible after rollback. The first

[sqlalchemy] SQLAlchemy, Postgres and ENum?

2008-04-20 Thread Matthew Dennis
I didn't see anything in the doc, and google wasn't much help in this case so I'm guessing that SA doesn't support a ENum type with PG? If not, are there standard/best practices for working around it in SA? --~--~-~--~~~---~--~~ You received this message because

[sqlalchemy] SA confusing timestamp with interval?

2008-04-18 Thread Matthew Dennis
I'm using SA 0.4.3 and PostgreSQL 8.3.1 I'm new to SA, so perhaps I'm doing something wrong or just not understanding something, but I think SA is trying to treat my timestamps as intervals in some cases. If I run the equivalent (select c0 from t0 where c0 current_timestamp - interval '1 hour')

[sqlalchemy] Re: SA confusing timestamp with interval?

2008-04-18 Thread Matthew Dennis
) with time zone)) cur.execute(insert into t0 values(current_timestamp)) cur.execute(select c0 from t0 where c0 %(bindArg)s - interval '1 hour', {'bindArg':datetime.utcnow()}) On Fri, Apr 18, 2008 at 6:26 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 18, 2008, at 4:42 PM, Matthew Dennis wrote

[sqlalchemy] Re: SA confusing timestamp with interval?

2008-04-18 Thread Matthew Dennis
: On Apr 18, 2008, at 10:20 PM, Matthew Dennis wrote: I get a similar result if I use psycopg2 directly: #!/usr/bin/python import psycopg2 from datetime import datetime conn = psycopg2.connect('''dbname=testdb user=postgres host=localhost''') cur = conn.cursor

[sqlalchemy] Clause Visitor changes causing issues.

2007-04-26 Thread Dennis
called, but I placed logging statements in my visit_table(self,table) method and it isn't being called. Do I need to specify something additional? Is there a ClauseVisitor example somewhere. Thanks Dennis --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: Deep Eagerload

2007-03-12 Thread Dennis
nope, options(eagerload('a'), eagerload('a.b')) works just fine, have tested it here to verify You're quite correct.. Sorry for the noise. I had tried it a while back and it didn't work yet. But in between now and then, it has magically been implemented by you! Thanks Dennis

[sqlalchemy] Deep Eagerload

2007-03-09 Thread Dennis
? -Dennis --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more

[sqlalchemy] Re: Deep Eagerload

2007-03-09 Thread Dennis
a mapper for a that doesn't lazyload b and use that mapper instead. -Dennis --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Dynamically building a query with a join

2007-03-05 Thread Dennis
ON , a LEFT OUTER JOIN c ON ... sel.execute() SQLError: (ProgrammingError) table name a specified more than once What I really need is: a.outerjoin(b).outerjoin(c) That is what I can't seem to find a way to dynamically generate. Thanks -Dennis On Mar 5, 3:16 pm, Michael Bayer [EMAIL PROTECTED] wrote

[sqlalchemy] Re: Dynamically building a query with a join

2007-03-05 Thread Dennis
I did find a slight hack: query.append_from ( query.froms._list[0].outerjoin( etc ... ) ) -Dennis On Mar 5, 3:54 pm, Dennis [EMAIL PROTECTED] wrote: Actually, I'm still having a problem because the primary object is already a join and the next object that I append gets listed twice

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-03-01 Thread Dennis
Thanks! On Mar 1, 1:31 pm, Michael Bayer [EMAIL PROTECTED] wrote: yeah its a bug, its all fixed (several issues with text columns) in 2368. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-02-28 Thread Dennis
] wrote: yeah with text just say as sometable_somecolumn. On Feb 27, 2007, at 4:16 PM, Dennis wrote: Well, columnname isn't a simple column in the case of a case statement... the label is turning out like this: casewhenhas_testtrueandscoreisnullandgender1then1whenscoreisnullthen2

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-02-27 Thread Dennis
breaks because the generated sql has two as label parts two it. if I delete the as something part, I think don't know programatically what the label is though. I need to know that because I order by it. Isn't there a way to find out a column label from a query? -Dennis On Feb 27, 12:47 pm

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-02-27 Thread Dennis
=True, I has appended as score to the case clause and that worked. On Feb 27, 2:44 pm, Michael Bayer [EMAIL PROTECTED] wrote: the label is always tablename_columnname. youd have to show me where you need that to be programmatic. On Feb 27, 2007, at 2:29 PM, Dennis wrote: Thanks for taking

[sqlalchemy] Re: Full Text Search using PostgreSQL and tsearch2

2007-02-02 Thread Dennis
=MyObj.mapper.instances(tsearch.execute()) -Dennis --~--~-~--~~~---~--~~ 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

[sqlalchemy] MapperExtension with options

2007-02-01 Thread Dennis
obj=query(MyObj).options(extension(MyExt)).select() MyExt isn't printing anything though.. Am I missing something? Thanks Dennis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Re: about cascade rule

2007-02-01 Thread Dennis
as well as obj and the transaction worked: obj = A('x') bobj=B('hi') # I modified your constructor to not take the id as well bobj.a=obj sess.save(obj) I'm not sure if it is a bug or feature either but perhaps a different cascade rule will alter the behavior. -Dennis

[sqlalchemy] Re: MapperExtension with options

2007-02-01 Thread Dennis
On Feb 1, 12:58 pm, Michael Bayer [EMAIL PROTECTED] wrote: ah the mapper isnt taking into account the extensions that are local to the query during the _instance() phase. we can add a ticket for that. http://www.sqlalchemy.org/trac/ticket/454

[sqlalchemy] sorting mapped class by joined subquery result (error)

2007-01-31 Thread Dennis
need this to work so I don't have to write my great big huge dynamic query out by hand so I'll be digging into the sqlalchemy code for a second. Is there is quick easy fix though? Thanks -Dennis --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: sorting mapped class by joined subquery result (error)

2007-01-31 Thread Dennis
Sorry if this posts twice... I didn't get a Message has been sent page last time.. I posted a bug with a test case here: http://www.sqlalchemy.org/trac/ticket/449 Thanks Dennis --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: sorting mapped class by joined subquery result (error)

2007-01-31 Thread Dennis
I've created a bug with an attached test: http://www.sqlalchemy.org/trac/ticket/449 Thanks! -Dennis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Re: sorting mapped class by joined subquery result (error)

2007-01-31 Thread Dennis
is that in the docs, the mapper is defined with lazy=False. That was a little confusing, but perhaps it is supposed to be that way. I would have thought that contains_eager implies eagerload. -Dennis On Jan 31, 12:27 pm, Michael Bayer [EMAIL PROTECTED] wrote: quick easy fix is to use result set mapping

[sqlalchemy] lazyload issue with new object creation

2007-01-30 Thread Dennis
code doesn't have another mechanism besides the primary key to know if the properties need loaded or not. If it does, there might be a simple workaround to avoid the nuance above. Thanks All -Dennis --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] sqlsoup and transactions

2007-01-16 Thread Dennis
committing. The flush call fails because it attempts to insert the data in the wrong order and there are foreign key violations. What do you think Jonathan? -Dennis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] many to many on another many to many

2006-12-26 Thread Dennis Schulz
be the reason why it is not working. Thank you for any help. Dennis -- tables

[sqlalchemy] Re: Performing a search

2006-11-06 Thread Dennis
currently doing that with Postgresql (tsearch2) for a project and it works quite well. -Dennis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy