(results.keys()==['this'])
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
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
Sorry should have mentioned that I get this with 0.6.6 and 0.6.3
On 01/19/2011 10:27 AM, David Gardner wrote:
Ran into an issue with having periods in column headings of SQL queries.
--
import sqlalchemy as sa
print(sa.__version__)
DB_URI = postgresql+psycopg2://test:test@localhost
, at 1:27 PM, David Gardner wrote:
import sqlalchemy as sa
print(sa.__version__)
DB_URI = postgresql+psycopg2://test:test@localhost/testdb
engine = sa.create_engine (DB_URI)
qry = SELECT 1 AS test.this;
results = engine.execute(qry)
print(results.keys()==['this'])
--
You received this message
. Thanks
to Conor and Michael Bayer for
their help a while back on a compiler extension for string_agg().
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group
]),
order_by=TestCaseMethod.id)
I've done zero SQLAlchemy optimization in my career thus far, and very
little ORM optimization (a bit with Hibernate several years ago), so
any advice is appreciated. :)
Thanks,
Alec
--
David Gardner
Pipeline Tools Programmer
with sessionmaker() for general use,
however.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch
() conversion.
Thank you _literal_as_column() worked for me. This allows me to use a
column from an aliased class.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
this in SQLAlchemy?
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
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
I should have linked to the docs in question
http://developer.postgresql.org/pgdocs/postgres/sql-expressions.html#SYNTAX-AGGREGATES
On 08/27/2010 03:03 PM, David Gardner wrote:
Recently Postgres added a new aggregate function called string_agg().
I have been able to use it like:
Session.query
/2010 05:06 PM, David Gardner wrote:
I should have linked to the docs in question
http://developer.postgresql.org/pgdocs/postgres/sql-expressions.html#SYNTAX-AGGREGATES
On 08/27/2010 03:03 PM, David Gardner wrote:
Recently Postgres added a new aggregate function called string_agg().
I have
...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group
...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group
athttp://groups.google.com/group/sqlalchemy?hl=en.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard
to the
__version__ string?
is there some guideline for the format on that ?
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send
DECLARE @return_value int
EXEC@return_value = [dbo].[assp_Report_DailyTransactions]
@start_date = N'07/01/2010',
@end_date = N'07/15/2010'
SELECT 'Return Value' = @return_value
Thanks,
Lucas
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature
I was wondering if there was a way to check at runtime if the C
extensions were built with SQLAlchemy?
If not I was wondering if you would consider adding something to the
__version__ string?
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
, visit this group
athttp://groups.google.com/group/sqlalchemy?hl=en.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group
)
AS users_1 ON users_1.user_id = user_report_1.user
Like I mentioned, I already have a work-around for this, and I realize
this is a function of the way I
defined my mappers.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message
more details?
Werner
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
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
a '*' in front of the list variable:
query.order_by(*order_list)
On 05/12/2010 10:49 AM, werner wrote:
David,
On 12/05/2010 18:00, David Gardner wrote:
Looks like your issuing query like:
query.order_by([col1, col2])
Should have thought about that one, i.e. search for order_by([ instead
of just
it just takes a callable, we should add verbiage that the
configure process has additional requirements.
On May 10, 2010, at 12:51 PM, David Gardner wrote:
Not sure if this is a bug or not, but I am not able to call configure() on a
ScopedSession that was created with create_session as it's
know, there might be good reasons for this. In any
case I'm trying to figure out how to write my Comparator for hstore
without repeating myself a lot.
Current implementation attached, with really hacky tests at the end :)
Comments welcome.
-Kyle
--
David Gardner
Pipeline Tools Programmer
to maintain a
copy of the original version of the attribute in order to check for
changes.
Good information, thanks. I can see why this would need to be handled
specially.
-Kyle
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received
appreciate it.
Thanks.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
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
).filter(Employee.something == something).all()
Could you please teach me what to import as well? What are the
necessary modules required for calling stored procedures in
SQLAlchemy?
Thanks a million guys!
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard
session.expunge_all() instead worked around the
issue.
On 04/07/2010 01:08 PM, Michael Bayer wrote:
these issues are all repaired as of r9b02710ca3b3.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you
/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/dialects/postgresql/psycopg2.py,
line 97, in result_processor
raise exc.InvalidRequestError(Unknown PG numeric type: %d % coltype)
NameError: global name 'exc' is not defined
j.type
u'take'
ca.type
u'cam'
--
David Gardner
Pipeline
...@localhost/testdb')
metadata = MetaData(engine)
class A(object):
pass
a_table = Table('test_tbl', metadata,autoload=True)
mapper(A, a_table)
session=create_session()
node = session.query(A).get(6)
print node.real_array
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature
). I don't know that
there's a workaround for now other than using a TypeDecorator that
turns the returned list into a tuple.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--
You received this message because you are subscribed to the Google Groups
/sqlalchemy/util.pyc in unique_list(seq,
compare_with)
1087 def unique_list(seq, compare_with=set):
1088 seen = compare_with()
- 1089 return [x for x in seq if x not in seen and not seen.add(x)]
1090
1091 class UniqueAppender(object):
TypeError: unhashable type: 'list'
--
David
it.
Otherwise you might just take the easy route and say:
t2 = aliased(Task)
s.query(Task).join(t2, and_(Task.parent_asset==t2.asset,
Task.name==t2.name)).options(contains_eager(parent , alias=t2))
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard
() - but then you'd need to map the class twice, and
then you're dealing with something totally different.
there's a way to make this work which I'll eventually get to in ticket
1612.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
don't really know where to place the second clause.
In a query object, outerjoin is different:
outerjoin(*props, **kwargs) although I couldn't find much
documentation about it.
TIA,
Mariano.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
informations and
explanations about this behavior?
Thanks
L.FRANCOIS
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
.
David Gardner wrote:
Did a quick test using psycopg2 and it returns a tuple of six longs:
(9892718L, 1046L, 189L, 235L, 9890143L, 1105L)
---
import psycopg2
import psycopg2.extensions
DB_HOST = 'localhost'
DB_NAME = 'hdpsdb'
DB_USER = 'testuser'
DB_PASS
.
I don't think this really helps you avoid parsing the result yourself,
but at least you know why! :)
-Conor
David Gardner wrote:
Did a quick test using psycopg2 and it returns a tuple of six longs:
(9892718L, 1046L, 189L, 235L, 9890143L, 1105L
(func.farm.call_job_status('testshow')).first()
('(9892718,116,20,0,9886233,6349)',)
Looks like the TypeDecorator will do what I need.
Michael Bayer wrote:
David Gardner wrote:
I have a PostgreSQL function that returns a composite type (a text field
and 6 bigint columns).
Currently I am
='%s' host='%s' password='%s' %
(DB_NAME,DB_USER,DB_HOST,DB_PASS)
pg2con = psycopg2.connect(db_uri)
cursor=pg2con.cursor()
cursor.execute(SELECT * FROM farm.call_job_status('testshow');)
row = cursor.fetchone()
print row
cursor.close()
pg2con.close()
Michael Bayer wrote:
David Gardner wrote
probably parse the string, but that wouldn't be very elegant.
I was wondering is there an object that I can subclass to support this?
I tried passing in type_=(String,Integer,...) as well as
type_=composite(SomeObj) neither worked.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
, David Gardner wrote:
Ran across something that I suspect might be a bug. If I define my
table like:
asset_table = Table('asset', metadata,
Column('path', Text, primary_key=True,
server_default=FetchedValue(),
server_onupdate
.__class__.__mro__
+)) 3 \
+and self.value == other.value
def __getstate__(self):
execute a deferred value for serialization purposes.
if that works let's make a trac ticket to add tests for this.
--
David Gardner
Pipeline Tools Programmer
Jim
():
eq_(query.all(), [Foo(), Bar(), Bat()])
self.assert_sql_count(testing.db, go, 0)
i.e. run go(), do the eq_() assertion, then when complete assert that 0
SQL statements were executed.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
': 'testshow/eps/201/s01/t01'}
testshow/eps/201/s01/t01
When defined as PGText the output is:
testshow/eps/201/s01/t01
testshow/chr/test/test
testshow/eps/201/s01/t01
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
of this in the SQLA
distribution and I think I also saw a 3rd party implementation on Pypi at
some point.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message
I was able to reproduce this issue in a simple test using sqlite,
submitted as a bug
http://www.sqlalchemy.org/trac/ticket/1485
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this
By simple I mean it isn't based on my schema, and reproducable :)
Michael Bayer wrote:
four levels of inheritance ?! hardly simple. turn off the lazy=False for
now, its an eager loading issue.
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard
is not
necessarily wrong, but if you use expire() for now, you'll get better
results. or turn off the lazy=False. but yes its a bug.
David Gardner wrote:
By simple I mean it isn't based on my schema, and reproducable :)
Michael Bayer wrote:
four levels of inheritance ?! hardly simple. turn
--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy
Forgot to mention this is SQLAlchemy 0.5.5
David Gardner wrote:
I just ran across something I believe maybe a bug in session.refresh()
dealing with adjacency lists.
The situation is after a session.refresh() on a node (in my case a
'job'), the children and grandchildren
have some
= session.connection()
tmp = con.execute(ALTER TABLE farm.frame DISABLE TRIGGER ALL;)
# bunch of ORM code here in a big for loop
tmp = con.execute(ALTER TABLE farm.frame ENABLE TRIGGER ALL;)
except Exception,e:
session.rollback()
print str(e)
sys.exit(1)
--
David Gardner
OK looks like create_session() won't work I need to explicitly bind the
session to an engine:
Session = sessionmaker(bind=engine, autoflush=False, autocommit=True)
session = Session()
David Gardner wrote:
I'm trying to disable the server side triggers on one of my tables
before I run some
the engineer/manager stuff in a subquery.
On Jun 10, 2009, at 8:38 PM, David Gardner wrote:
I was wondering if there was a way to use with_polymorphic() on a
joined
table.
For instance using the Company-Employees relationship in the
example on
http://www.sqlalchemy.org/docs/05
(company_table.join(employees_table).outerjoin(engineers_table,
onclause).outerjoin(managers_table, onclause)).everything else.
you'll actually get a better query from the above since it won't wrap
the engineer/manager stuff in a subquery.
On Jun 10, 2009, at 8:38 PM, David Gardner wrote:
I
raise sa_exc.InvalidRequestError(Query.%s() being
called on a Query with existing criterion. % meth)
272
273 self._from_obj = ()
InvalidRequestError: Query.with_polymorphic() being called on a Query
with existing criterion.
--
David Gardner
Pipeline Tools Programmer
:
David Gardner wrote:
I'm having a bit of a problem eager loading the parent node of a
hierarchical tree-like table (ie, every node has one to many children).
If I simply add a options(eagerload(Asset.Parent)) to my query it
works as expected.
However often I need to select a node based
:
On May 1, 2009, at 2:55 PM, David Gardner wrote:
Along those same lines, one of the things I would like to do is to
do an arbitrary join, my table is hierarchical and often I want to
do a join against a a node, along with another node two levels deep
below it, and since its a tree
, at 5:17 PM, David Gardner wrote:
The problem I'm running into is what to pass into contains_eager().
In my table I'm mapping a file system, Asset.path is a unique
constraint, so my outerjoin() will either find a single row or none.
When I do:
scn_alias=aliased(Asset
the joined row are returned.
Attached is a test, and the output.
Note about the test, the path column of my table has a unique constraint
on it, all three of the queries return the same node, but only the first
returns the correct node mapped as Asset.Parent.
--
David Gardner
Pipeline Tools
:
parent = aliased(Asset)
query.join((parent, Asset.parent)).options(contains_eager(Asset.parent,
alias=parent))
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You
], from_obj[j])
Then later on I do:
session.query(MyObj).from_statement(my_qry.where(parent.c.foo==bar)).all()
Is there any reason why I shouldn't just keep my_qry instantiated and
use it as needed, or should I re-construct it for each query?
--
David Gardner
Pipeline Tools Programmer, Sid
Thanks that ended up working.
so a query like this would do it:
session.query(JobInfo).filter(~JobInfo.Job.has()
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You
ORDER BY farm.qstatus.job_name
2009-04-06 16:49:26,922 INFO sqlalchemy.engine.base.Engine.0x...0210 {}
[]
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received
, if the column is already
present in __table__. The column will be remapped to the given
key the same way as when added to the mapper() properties dict.
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
to get a list of all children
Question is how to specify a relation that gives a list of the boys
Parent.boys = relation(Child, ??)
I suspect it is something pretty straight forward, but can't figure it out
--
Mike Conley
--
David Gardner
Pipeline Tools Programmer
, but that
doesn't occur to me as naturally.
On Mar 23, 2009, at 9:02 PM, David Gardner wrote:
I have a simple many to many relationship between two objects: Task
and
Note, where notes are ordered by a timestamp column most recent first.
About 90% of the time what I really want to do is eagerload
, add correlate(None) to that
subquery.
David Gardner wrote:
So I attempted to implement this, and I think I got perty close but
ended up getting stuck on trying to get the mapper working. Using SA
0.5.2 w/ psycopg2 2.0.9.
First I worked out the SQL for what I wanted and got
lazy loaded, but to fail when eagerloaded
as part of a larger query against the task table.
Again thank you.
David Gardner wrote:
Thats it! Thank you so much, I turned on the echo, and the SQL looks
exactly as I expected.
Michael Bayer wrote:
you've got note.id AS id sneaking into your first
looking like:
tasks=session.query(Task).filter(Task.assigned_to=='dgardner').options(eagerload(Task.Notes)).all()
for task in tasks:
... if len(task.Notes):
... latest_note=task.Notes[0]
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard
the app spawns more than ~20 I get
the following error:
Assertion failed: (gc-gc.gc_refs != 0), function update_refs,
file Modules/gcmodule.c, line 261.
Abort trap
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard
are probably going to become more
commonplace, with the main thing to keep in mind that they're only
warnings. You can of course control the emission of warnings with a
high degree of granularity by using the Python warning filter.
On Jan 6, 2009, at 6:25 PM, David Gardner wrote:
I got
:
http://www.sqlalchemy.org/trac/browser/sqlalchemy/tags/rel_0_5_0/CHANGES
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message because
=True)},
save_on_init=False)
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy
, and I am not sure if I have done
anything that wouldn't work in 0.4.8.
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
dgard...@creatureshop.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed
-08:00'
session = create_session()
session.query(Note).from_statement(qry%(uid,name,updated)).first()
sys.exit(0)
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
[EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received
in 0.5 as of r5458, but keep in
mind first() still fetches the full result set of the query.
On Dec 10, 2008, at 3:14 PM, David Gardner wrote:
It seems what when using .first() with from_statement() I get a
traceback with 0.5rc4 when no rows are found (works when a row is
fount
= typehierarchy.parent)) AND typehierarchy.type =
%(type_1)s AND typehierarchy.project = %(project_1)s
2008-11-10 12:30:50,452 INFO sqlalchemy.engine.base.Engine.0x...9a10
{'type_1': 'h2_prj', 'project_1': 'sid'}
tn
[assetdb.TypeNode object at 0x201f3d0]
--
David Gardner
Pipeline Tools
))
})
print
create_session().query(Node).filter(Node.Parent==Node(id=2)).statement
output:
SELECT nodes.id, nodes.parent_id
FROM nodes
WHERE :param_1 = nodes.parent_id
On Nov 10, 2008, at 3:36 PM, David Gardner wrote:
Had a problem this morning where SA 0.5rc3 was returning None
IS NULL AND typehierarchy.type = %(type_1)s
AND typehierarchy.project = %(project_1)s
LIMIT 1 OFFSET 0
2008-11-10 14:25:04,489 INFO sqlalchemy.engine.base.Engine.0x...df50
{'type_1': 'h2_prj', 'project_1': 'sid'}
David Gardner wrote:
Had a problem this morning where SA 0.5rc3 was returning
of reverting
to my original mapper setup where I mapped the classes against select()
queries.
David Gardner wrote:
Aha! This worked perfectly. I followed your create_instance() example at
http://techspot.zzzeek.org/?p=4
I definitely owe you a beer!
Michael Bayer wrote:
On Oct 30, 2008
type' is defined
To complicate matters slightely this is a self referential table,
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/basic_tree.py
This isn't a huge problem because I could continue to use SA the way I
currently am.
--
David Gardner
Pipeline Tools
, mapper, context, row):
return MyRow(row, mapper.polymorpic_on)
mapper(MyClass, mytable, extension=MyExt())
allowing a callable polymorphic_on wouldn't be a hard feature to add
and its been planned to be eventually added.
On Oct 30, 2008, at 1:19 PM, David Gardner wrote:
I have
Aha! This worked perfectly. I followed your create_instance() example at
http://techspot.zzzeek.org/?p=4
I definitely owe you a beer!
Michael Bayer wrote:
On Oct 30, 2008, at 5:30 PM, David Gardner wrote:
This works. However although type=='file' is the only time I want/need
to have
this?
Thanks!
Eoghan
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
(323) 802-1717 [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy
I should mention that in my case, my sessions are non-autoflush, and
non-transactional, so I do my begin()/commits() explicitly.
David Gardner wrote:
Depending on how your code is layed out you could wrap your
session.flush() with a try:/catch I do something like this:
session.begin()
try
problem this could go into the FAQ,
if no one else has had this problem, then maybe I'm just crazy.
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
(323) 802-1717 [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received
==b_table.c.id,
b_table.c.sometext!='NOTHISONE']).alias('a_query')
mapper(AObject, a_query, properties = {'B' : relation(BObject,
primaryjoin=(b_table.c.id==a_query.c.b_id))})
Hermann Himmelbauer wrote:
Am Dienstag 26 August 2008 01:41:20 schrieb David Gardner:
I think what you might want
by the mapper
Is there a simple way to achieve this?
Best Regards,
Hermann
--
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
).order_by(JobInfo.c.job_name,
Chunk.c.pass_field, JobInfo.c.owner)
query = session.query(JobInfo).options(contains_eager('Chunk'))
r = query.from_statement(statement).all()
David Gardner wrote:
Thats it, I just need to use from_statement. OK this works producing
good SQL:
statement
=
farm.qstatus.job_number
LEFT OUTER JOIN farm.pass AS pass_1 ON pass_1.job = chunk_1.job AND
pass_1.name = chunk_1.pass
ORDER BY farm.qstatus.job_name, farm.pass.name, farm.qstatus.owner,
chunk_1.job, pass_1.name
--
David Gardner
Pipeline Tools Programmer, Sid the Science Kid
Jim Henson Creature Shop
(323) 802-1717
={
'Chunk':relation(Chunk, lazy=True, uselist=False,
primaryjoin=chunk_table.c.queue_job_id==qstat_table.c.job_number,
foreign_keys=[chunk_table.c.queue_job_id])})
Michael Bayer wrote:
On May 7, 2008, at 1:52 PM, David Gardner wrote
to ensure that at least a *lazy* load
works). temp table/no pks/no fks have no impact here since you are
defining those things on your mapper.
Feel free to produce a standalone script using sqlite illustrating the
table structure, ORM setup, and ORM query you're trying to do.
--
David
I have an adjacency table setup similar to this example:
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/basic_tree.py
However I am distinguishing between nodes and leaves. So I have my
Node() and Leaf(Node) classes setup, and I am currently mapping them
against
This is probably not a SQLAlchemy issue, but thought I should share with
the group in case there were other Pydev+Eclipse users out there.
I recently came across an issue that when debugging code using Pydev,
the code would hang whenever I tried to step over a statement of
SQLAlchemy code. I
Ran into something this morning, fix and problem are simple.
Q) How do I map a column that is a Python reserved word or already used
by SA?
A)
table_a = Table ('tbl_a', metadata, autoload=True)
mapper(AObj, table_a, properties={'type_col' : table_a.c.type,
'pass_col':table_a.c['pass']})
This
Ran across a weird issue this morning, not sure if its even a SA issue,
may just be PostgreSQL (8.3) being weird.
I recently merged two pgsql databases into one database with two
schemas, and a foreign key connecting two of the tables.
he first schema is in the search path, the second is not.
Thank you this worked for me.
You can put the child order by at the end using reset_joinpoint():
grandchildren = session.query(Node).filter(Node.c.type==var1).\
join('Parent', aliased=True).filter(Node.c.type==var2).\
order_by(Node.name).\
join('Parent',aliased=True,from_joinpoint=True).\
Well sort of... This worked on my local development box (0.4.2p3), but
my server is still on 0.4.0 and the data is sorted by grandchild only.
I am assuming this is expected and I just need to upgrade my server to
get this working?
David Gardner wrote:
Thank you this worked for me.
You
I have a self referential hierarchy structure in a table that I have
mapped with SA 0.4. What I would like to do is query the table given a
node, and find its grandchildren based on some criteria in both the
child and grandchildren nodes. In SQL I would do:
SELECT * FROM nodehierarchy AS
Maybe this could go into the FAQ? This post really helped me update some
code using SA 0.3.
Gaetan de Menten wrote:
On Dec 20, 2007 8:50 AM, iain duncan [EMAIL PROTECTED] wrote:
Sorry if this seems a stupid question, but I thought that Mike had said
that in sa0.4, if you used
I have three tables a(a query of a really), b, c
a has a 1-many relationship with b
c has a 1-many relationship with b
What I would like to do is in my mapper for table c, is sort the order
of rows from b by a.name.
I don't know how to do this or if it is possible. What I have looks like:
I believe what you need to do is get an instance of a language object
something like:
item.Language = session.query(Language).filter_by(name='en').first()
There maybe a better way to do this, but its how I currently do it (so
if there is a better way I would like to know).
paftek wrote:
Hi,
1 - 100 of 101 matches
Mail list logo