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
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
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
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
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
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
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)
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
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
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
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')
) 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
:
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
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
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
?
-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
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
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
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
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
] 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
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
=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
=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
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
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
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
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
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
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
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
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
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
be the reason why it is
not working.
Thank you for any help. Dennis
--
tables
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
35 matches
Mail list logo