[sqlalchemy] ResultProxy bug?

2011-01-19 Thread David Gardner
(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

Re: [sqlalchemy] ResultProxy bug?

2011-01-19 Thread David Gardner
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

Re: [sqlalchemy] ResultProxy bug?

2011-01-19 Thread David Gardner
, 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

[sqlalchemy] tuple type decorator for PGArray, and array_agg() compiler extension

2010-10-19 Thread David Gardner
. 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

Re: [sqlalchemy] Optimizing performance of hierarchical data structure loading

2010-09-07 Thread David Gardner
]), 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

Re: [sqlalchemy] SQLAlchemy 0.6.4 Released

2010-09-07 Thread David Gardner
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

Re: [sqlalchemy] string_agg() with order by clause

2010-08-30 Thread David Gardner
() 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

[sqlalchemy] string_agg() with order by clause

2010-08-27 Thread David Gardner
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

Re: [sqlalchemy] string_agg() with order by clause

2010-08-27 Thread David Gardner
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

Re: [sqlalchemy] string_agg() with order by clause

2010-08-27 Thread David Gardner
/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

Re: [sqlalchemy] How to filter by date with SA 0.6?

2010-08-17 Thread David Gardner
...@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

Re: [sqlalchemy] Re: Unknown Issue Causing Extremely Slow Query

2010-07-19 Thread David Gardner
...@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

Re: [sqlalchemy] checking for C extensions at runtime

2010-07-16 Thread David Gardner
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

Re: [sqlalchemy] how to run a stored procedure?

2010-07-15 Thread David Gardner
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

[sqlalchemy] checking for C extensions at runtime

2010-07-15 Thread David Gardner
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

Re: [sqlalchemy] Re: Why does SA (only 0.6.x) read data from n:m relationships when updating the parent table?

2010-07-09 Thread David Gardner
, 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

[sqlalchemy] innerjoin and eagerloading

2010-05-26 Thread David Gardner
) 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

Re: [sqlalchemy] migrating to 0.6

2010-05-12 Thread David Gardner
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

Re: [sqlalchemy] migrating to 0.6

2010-05-12 Thread David Gardner
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

Re: [sqlalchemy] scoped_session(create_session) 0.6

2010-05-10 Thread David Gardner
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

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-07 Thread David Gardner
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

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-05 Thread David Gardner
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

Re: [sqlalchemy] Storing Nested Lists

2010-04-27 Thread David Gardner
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

Re: [sqlalchemy] Using SQLAlchemy to call stored procedures

2010-04-27 Thread David Gardner
).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

Re: [sqlalchemy] NameError: global name 'exc' is not defined (0.6beta3)

2010-04-08 Thread David Gardner
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

[sqlalchemy] NameError: global name 'exc' is not defined (0.6beta3)

2010-04-07 Thread David Gardner
/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

Re: [sqlalchemy] NameError: global name 'exc' is not defined (0.6beta3)

2010-04-07 Thread David Gardner
...@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

Re: [sqlalchemy] array_agg() in ORM entities (0.5.8)?

2010-04-02 Thread David Gardner
). 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] array_agg() in ORM entities (0.5.8)?

2010-04-01 Thread David Gardner
/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

[sqlalchemy] Re: little trouble remote_side when local col points to same col in parent

2009-11-09 Thread David Gardner
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

[sqlalchemy] Re: little trouble remote_side when local col points to same col in parent

2009-11-09 Thread David Gardner
() - 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

[sqlalchemy] Re: outer join with two clauses

2009-10-27 Thread David Gardner
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

[sqlalchemy] Re: setattr and mapped ORM

2009-10-21 Thread David Gardner
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

[sqlalchemy] Re: sqlalchemy.sql.expression.func and composite types

2009-10-15 Thread David Gardner
. 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

[sqlalchemy] Re: sqlalchemy.sql.expression.func and composite types

2009-10-15 Thread David Gardner
. 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

[sqlalchemy] Re: sqlalchemy.sql.expression.func and composite types

2009-10-14 Thread David Gardner
(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

[sqlalchemy] Re: sqlalchemy.sql.expression.func and composite types

2009-10-14 Thread David Gardner
='%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

[sqlalchemy] sqlalchemy.sql.expression.func and composite types

2009-10-13 Thread David Gardner
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

[sqlalchemy] Re: Text vs. PGText possible bug

2009-09-25 Thread David Gardner
, 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

[sqlalchemy] Re: Text vs. PGText possible bug

2009-09-25 Thread David Gardner
.__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

[sqlalchemy] Re: Text vs. PGText possible bug

2009-09-25 Thread David Gardner
(): 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

[sqlalchemy] Text vs. PGText possible bug

2009-09-24 Thread David Gardner
': '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

[sqlalchemy] Re: Hierarchical data: Get all (sub-) children? Parents?

2009-07-28 Thread David Gardner
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

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
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

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
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

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
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

[sqlalchemy] session.refresh() bug with adjacency lists?

2009-07-24 Thread David Gardner
-- 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

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-24 Thread David Gardner
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

[sqlalchemy] disabling PostgreSQL triggers for block of SA orm code

2009-06-25 Thread David Gardner
= 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

[sqlalchemy] Re: disabling PostgreSQL triggers for block of SA orm code

2009-06-25 Thread 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

[sqlalchemy] Re: using with_polymorphic() on joined tables

2009-06-12 Thread David Gardner
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

[sqlalchemy] Re: using with_polymorphic() on joined tables

2009-06-11 Thread David Gardner
(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

[sqlalchemy] using with_polymorphic() on joined tables

2009-06-10 Thread David Gardner
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

[sqlalchemy] Re: contains_eager and self-referential queries

2009-05-01 Thread David Gardner
: 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

[sqlalchemy] Re: contains_eager and self-referential queries

2009-05-01 Thread David Gardner
: 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

[sqlalchemy] Re: contains_eager and self-referential queries

2009-05-01 Thread David Gardner
, 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

[sqlalchemy] contains_eager and self-referential queries

2009-04-29 Thread David Gardner
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

[sqlalchemy] Re: contains_eager and self-referential queries

2009-04-29 Thread David Gardner
: 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

[sqlalchemy] select() ussage

2009-04-24 Thread David Gardner
], 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

[sqlalchemy] Re: select A join B where B is null

2009-04-07 Thread David Gardner
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

[sqlalchemy] select A join B where B is null

2009-04-06 Thread David Gardner
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

[sqlalchemy] Re: SQLAlchemy 0.5.3 released

2009-03-31 Thread David Gardner
, 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

[sqlalchemy] Re: Filtering a relation

2009-03-27 Thread David Gardner
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

[sqlalchemy] Re: eagerload first in relation?

2009-03-24 Thread David Gardner
, 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

[sqlalchemy] Re: eagerload first in relation?

2009-03-24 Thread David Gardner
, 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

[sqlalchemy] Re: eagerload first in relation?

2009-03-24 Thread David Gardner
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

[sqlalchemy] eagerload first in relation?

2009-03-23 Thread David Gardner
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

[sqlalchemy] Re: POSTGRE Error with scoped sessions.

2009-01-08 Thread David Gardner
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

[sqlalchemy] Re: new warning with 0.5.0

2009-01-08 Thread David Gardner
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

[sqlalchemy] Re: SQLAlchemy 0.5 Released

2009-01-06 Thread David Gardner
: 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

[sqlalchemy] new warning with 0.5.0

2009-01-06 Thread David Gardner
=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

[sqlalchemy] 0.5 release schedule

2008-12-18 Thread David Gardner
, 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

[sqlalchemy] first() fails with from_statement in 0.5rc4

2008-12-10 Thread David Gardner
-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

[sqlalchemy] Re: first() fails with from_statement in 0.5rc4

2008-12-10 Thread David Gardner
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

[sqlalchemy] 0.5rc3 problem (works in 0.5rc2 and 0.4.8)

2008-11-10 Thread David Gardner
= 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

[sqlalchemy] Re: 0.5rc3 problem (works in 0.5rc2 and 0.4.8)

2008-11-10 Thread David Gardner
)) }) 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

[sqlalchemy] Re: 0.5rc3 problem (works in 0.5rc2 and 0.4.8)

2008-11-10 Thread David Gardner
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

[sqlalchemy] Re: single table inheritance mapping

2008-11-04 Thread David Gardner
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

[sqlalchemy] single table inheritance mapping

2008-10-30 Thread David Gardner
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

[sqlalchemy] Re: single table inheritance mapping

2008-10-30 Thread David Gardner
, 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

[sqlalchemy] Re: single table inheritance mapping

2008-10-30 Thread David Gardner
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

[sqlalchemy] Re: ProgrammingError and Catching an Exception

2008-09-11 Thread David Gardner
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

[sqlalchemy] Re: ProgrammingError and Catching an Exception

2008-09-11 Thread David Gardner
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

[sqlalchemy] weird OSX Leopard psycopg2 failed to import problem (and solution)

2008-09-07 Thread David Gardner
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

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread David Gardner
==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

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-25 Thread David Gardner
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

[sqlalchemy] Re: eagerload vs. joins

2008-05-08 Thread David Gardner
).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

[sqlalchemy] eagerload vs. joins

2008-05-07 Thread David Gardner
= 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

[sqlalchemy] Re: eagerload vs. joins

2008-05-07 Thread David Gardner
={ '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

[sqlalchemy] Re: eagerload vs. joins

2008-05-07 Thread David Gardner
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

[sqlalchemy] adjacency tree question

2008-04-21 Thread David Gardner
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

[sqlalchemy] SQLAlchemy hangs with Pydev 1.3.14, works with 1.3.13

2008-04-11 Thread David Gardner
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

[sqlalchemy] proposed FAQ entry

2008-03-05 Thread David Gardner
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

[sqlalchemy] weird SA + PostgreSQL with two schemas issue

2008-02-25 Thread David Gardner
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.

[sqlalchemy] Re: self referential query with order_by

2008-02-11 Thread David Gardner
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).\

[sqlalchemy] Re: self referential query with order_by

2008-02-11 Thread David Gardner
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

[sqlalchemy] self referential query with order_by

2008-02-07 Thread David Gardner
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

[sqlalchemy] Re: 0.4 deprecation warnings, what is the new get_by/select_by?

2007-12-20 Thread David Gardner
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

[sqlalchemy] order_by on related table

2007-12-05 Thread David Gardner
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:

[sqlalchemy] Re: Filling foreign key with mapping

2007-12-05 Thread David Gardner
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   2   >