Re: [sqlalchemy] Creating a feed related to different object type

2012-12-05 Thread Eric Ongerth
surprised by the speed of the event solution provided by SQLAlchemy, as I always heard that event listener on DB object were evil, but it turned out to almost add no overhead (test operated 2k object creation). On Sat, Dec 1, 2012 at 10:35 PM, Eric Ongerth erico...@gmail.comjavascript: wrote

Re: [sqlalchemy] Why not seeing ondelete='xxx', and onupdate='xxx' in alembic migration script?

2012-12-05 Thread Eric Ongerth
Thank you very much for that resolution! I use these a lot. On Wednesday, December 5, 2012 12:37:54 PM UTC-8, Michael Bayer wrote: On Dec 5, 2012, at 2:56 PM, junepeach wrote: I defined several tables in my module file: mymodule.py. For example I have table T1 and T2 defined: class

[sqlalchemy] Re: Best practice for faves/likes counting?

2012-12-05 Thread Eric Ongerth
But work.like_query.count() will be efficient if you have the right indexes in the database, no? I think if you want to denormalize that count all the way and also stay very efficient, maybe it would be good to do it right on the db server with a trigger and a stored procedure and avoid extra

Re: [sqlalchemy] Creating a feed related to different object type

2012-12-01 Thread Eric Ongerth
Hi Brice, Yours is another good case of the 'Generic Associations' or 'Polymorphic Association' pattern which comes up quite often. Here's a link to some docs that will get you going on a good solution that keeps the database normalized.

[sqlalchemy] Re: SQLA app and Django app using the same database

2012-10-27 Thread Eric Ongerth
Generally no problem due to the different ORMs. There is potential for concurrency issues just as if you had two apps with the same ORM accessing the same database. On Friday, October 26, 2012 7:56:06 AM UTC-7, Diego Woitasen wrote: Hi, I'm developing an application that access a DB that

[sqlalchemy] Re: Saas deployment suggestions for SQLAlchemy?

2012-06-25 Thread Eric Ongerth
+1 on seeing thoughts in response to Iain's post! On Tuesday, May 1, 2012 8:14:42 AM UTC-7, Iain Duncan wrote: Hey all, we've been using SQLAlchemy for about 5 years now, currently with Pyramid, but have not ever deployed to anything other than a standard vps for a one client install.

[sqlalchemy] Re: auto reflect to create table declarative table code

2012-06-07 Thread Eric Ongerth
Ben, I think I might have seen you write in IRC that you had already decided not to autoreflect after all, not sure if this is the same person. But in any case, I wanted to say that one good reason NOT to autoreflect is as follows. If you do the work of building a declarative model for your

[sqlalchemy] '_Label' object has no attribute 'nullable'

2012-05-17 Thread Eric Ongerth
(using sqlalchemy 0.8.0b1) Using the new 8.0 inspection mechanism, I can perform the following on one of my model classes in an ipython or bpython shell and obtain a boolean result: [... bunch of imports to load up my model classes ...]

[sqlalchemy] Re: '_Label' object has no attribute 'nullable'

2012-05-17 Thread Eric Ongerth
Answered my own question here. My code was actually working fine at runtime, it's just that one of the objects it encountered which I had thought was a simple column was actually a ColumnProperty which of course had no 'nullable' attribute. On Thursday, May 17, 2012 3:08:21 AM UTC-7, Eric

[sqlalchemy] Re: PostgreSQL 9.1 on the horizon, cool new stuff

2011-07-14 Thread Eric Ongerth
Not that anyone actually needed it, but it was fun to filter and summarize. (caffeine sink) On Jul 11, 11:41 pm, Warwick Prince warwi...@mushroomsys.com wrote: Thanks for the 'heads-up' Eric :-) ! Nothing to see here, move right along ! Except... Couple of interesting additions

[sqlalchemy] Re: SQL Server weird sorting behaviour

2011-07-14 Thread Eric Ongerth
Sounds like you might want to set a different collation? I don't know if sql server lets you do that per column, per table, or just per database. http://msdn.microsoft.com/en-us/library/ms144250.aspx --- some collation examples On Jul 14, 4:51 am, Massi massi_...@msn.com wrote: Hi everyone,

[sqlalchemy] Re: Can't get sqlalchemy to backup or restore MSSQL database

2011-07-11 Thread Eric Ongerth
I think more common practice is just to use shell scripts (whether in scheduled tasks / cron jobs or manually) for backup. But I don't know MSSQL specifically. I just have rarely heard of anyone trying to accomplish their backup with SQLAlchemy as part of the chain of command. On Jul 11, 2:06 

[sqlalchemy] Re: Conditional insert in one transaction

2011-06-18 Thread Eric Ongerth
Just curious and learning here -- There are two separate issues here, aren't there? (1.) Atomicity of the transaction, taken care of by the above discussion, and (2.) what if there was a need to have it be not only atomic but consume as little time as possible between the read and write, let's

[sqlalchemy] maybe check for near-miss underscored parameters in declarative classes?

2011-06-11 Thread Eric Ongerth
I'm plus or minus on this, not sure, but thought it might be worth bringing up. I had the following typo in a declarative class def: class Foo(Base): __tablename__ = 'foo_table' __table_args_ = {'mysql_engine':'InnoDB', 'mysql_charset':'utf8'} ... so I had only one underscore character

[sqlalchemy] Re: Polymorphic forces table definition outside of declarative class?

2011-06-09 Thread Eric Ongerth
from a single parent class and all the accompanying baggage of inheritance and incurring joins on more queries than necessary. Thanks again for the guidance on that in the past. On Jun 8, 2:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 8, 2011, at 5:19 PM, Eric Ongerth wrote

[sqlalchemy] Polymorphic forces table definition outside of declarative class?

2011-06-08 Thread Eric Ongerth
# Currently I have to do this: from sqlalchemy import Table, Column, Text, Integer Base = sqlahelper.get_base() sometable = Table('sometable', Base.metadata, Column('id', Integer, primary_key=True), Column('discriminator', Text), Column('data', Text)) class

[sqlalchemy] Re: Defining a relationship without a foreign key constraint?

2011-03-16 Thread Eric Ongerth
Mike's suggestion is correct, and I want to add that relationship() / relation() do not require a foreign key constraint, they just are able to figure out the mapping more automatically (without a primaryjoin argument in unambiguous cases) if you do have one existing on the table. On Mar 15,

[sqlalchemy] Re: two-way attribute relationships through associationproxy

2011-03-16 Thread Eric Ongerth
not expect that to work. So then I thought maybe the backrefs just need to be on the relationships defined on the B class. The above post was my third try, where I attempted to just make the whole setup symmetrical between A and C. On Mar 14, 4:44 pm, Eric Ongerth ericonge...@gmail.com wrote

[sqlalchemy] Re: How to write and access attribute in many to many table

2011-03-14 Thread Eric Ongerth
Nothing prevents the use of associationproxy with Declarative. On Mar 14, 3:26 am, Christian Démolis christiandemo...@gmail.com wrote: Hi all, I have a question about many to many Table containing attribute. How to access and write Max attribute in many to many table ? I already read that

[sqlalchemy] two-way attribute relationships through associationproxy

2011-03-14 Thread Eric Ongerth
from sqlalchemy import Unicode, Integer, Column, create_engine, ForeignKey from sqlalchemy.orm import relationship, Session from sqlalchemy.orm.collections import MappedCollection from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.associationproxy import association_proxy

[sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-13 Thread Eric Ongerth
on how to replace the dict in one of these situations with a defaultdict? Just override __setitem__ and __getitem__ ? - Eric On Mar 12, 10:26 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 10, 2011, at 6:20 PM, Eric Ongerth wrote: So, jek, if you're listening, or anyone else

[sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-13 Thread Eric Ongerth
Cool! I was unaware of __missing__. Thanks again. On Mar 13, 10:24 am, Michael Bayer mike...@zzzcomputing.com wrote: its probably easier to use __missing__ - see attached.  dict_of_sets_with_default.py 1KViewDownload On Mar 13, 2011, at 4:26 AM, Eric Ongerth wrote: Thank you, Mike

[sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-13 Thread Eric Ongerth
. Any suggestions on how to replace the dict in one of these situations with a defaultdict?  Just override __setitem__ and __getitem__ ? - Eric On Mar 12, 10:26 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 10, 2011, at 6:20 PM, Eric Ongerth wrote: So, jek, if you're listening

[sqlalchemy] Re: Joined Table Inheritance question

2011-03-10 Thread Eric Ongerth
Or just leave the polymorphic_entity='employee' and put a CHECK constraint on the table enforcing that the value of that column is not 'employee'. Or just don't code anything that can add a generic employee :) On Mar 10, 8:23 am, Franck franck.pe...@gmail.com wrote: I'm trying to reply

[sqlalchemy] Has anyone already got a collection_class mod that uses defaultdict?

2011-03-10 Thread Eric Ongerth
I make occasional use of alternate collection classes for my sqlalchemy relationships. For example, column_mapped_collection. The existing collection classes in sqlalchemy.orm.collections work really well for me; I have a lot of relational data that very naturally belongs in dicts rather than

[sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-10 Thread Eric Ongerth
, 1:02 pm, Eric Ongerth ericonge...@gmail.com wrote: I make occasional use of alternate collection classes for my sqlalchemy relationships.  For example, column_mapped_collection.  The existing collection classes in sqlalchemy.orm.collections work really well for me; I have a lot of relational

[sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-10 Thread Eric Ongerth
So, jek, if you're listening, or anyone else -- is there an already existing, working implementation of a Dict of Lists or Dict of Sets collection class? On Mar 10, 1:55 pm, Eric Ongerth ericonge...@gmail.com wrote: Ach, I did it again... proceeded as if column_mapped_collection

[sqlalchemy] Re: cascading deletes

2011-02-25 Thread Eric Ongerth
Wouldn't he need to configure the ondelete cascade for even session.delete(session.query(User).get('testname')) to work that way? I know why the cascade is necessary for session.query(User).delete() to also delete the associated IP instances. But I don't quite get why it's not necessary for

[sqlalchemy] Re: Create Database trought sqlalchemy 0.6.6 !

2011-02-22 Thread Eric Ongerth
sqlalchemy allows you to issue any literal sql statements as text: http://www.sqlalchemy.org/docs/core/tutorial.html#using-text On Feb 22, 7:38 am, Toninho Nunes toninhonu...@gmail.com wrote: Hi, I would like to know how to create database with sqlalchemy using the PostGresql driver, are

[sqlalchemy] Re: Create Database trought sqlalchemy 0.6.6 !

2011-02-22 Thread Eric Ongerth
Even with that autocommit transaction isolation level, you probably need to commit the create database before you try to add tables to it. On Feb 22, 1:45 pm, Toninho Nunes toninhonu...@gmail.com wrote: Hi see my source code below import sqlalchemy import psycopg2 from sqlalchemy import

[sqlalchemy] Re: Dynamic relations...

2011-02-13 Thread Eric Ongerth
Polymorphic associations pop up a lot around here, don't they! I suppose it's partly because they would be so much more difficult to handle, or even come close to handling, conveniently, with most other ORM packages. Martijn, after running into the wall on polymorphic associations approximately

[sqlalchemy] Re: sqlalchemy rocks my socks off!

2011-01-15 Thread Eric Ongerth
+1 On Jan 13, 5:08 pm, rdlowrey rdlow...@gmail.com wrote: To Michael Bayer: sqlalchemy simplifies my life every day and makes me vastly more productive! Many thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] Re: change of discriminator column apparently not saved by session?

2011-01-03 Thread Eric Ongerth
to developing! Meanwhile the alternative solution in sa's SQL Expression language turned out to be far simpler too, required 5 lines of code instead of ~20. Thanks again! On Jan 2, 11:32 pm, Eric Ongerth ericonge...@gmail.com wrote: Right, you made that clear before. I was no longer talking about

[sqlalchemy] Re: change of discriminator column apparently not saved by session?

2011-01-02 Thread Eric Ongerth
need to fix up... now that's blindingly obvious. I welcome any commentary, though, on the sanity or insanity of my above paragraphs. Sqlalchemy rocks... Thanks! Eric On Jan 1, 2011, at 9:52 PM, Eric Ongerth wrote: I must be doing something wrong but can't find it. I'm doing some

[sqlalchemy] Re: change of discriminator column apparently not saved by session?

2011-01-02 Thread Eric Ongerth
to work out). Or too tempting for people to brew up all manner of ridiculous and unnecessary schema with it. Thank you for your thoughts. On Jan 2, 9:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 2, 2011, at 11:25 PM, Eric Ongerth wrote: On Jan 2, 7:59 am, Michael Bayer mike

[sqlalchemy] Re: change of discriminator column apparently not saved by session?

2011-01-02 Thread Eric Ongerth
with this approach when it's not to your liking. It's just that at this point I'm trying to work it all the way through in this manner just to come to a better understanding of the ORM's workings. On Jan 2, 9:55 pm, Eric Ongerth ericonge...@gmail.com wrote: Ah!  I did it again.  You may or may

[sqlalchemy] Re: change of discriminator column apparently not saved by session?

2011-01-02 Thread Eric Ongerth
for not bothering with multiple inheritance in sa are great, thanks for describing them. On Jan 2, 11:09 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 3, 2011, at 2:02 AM, Eric Ongerth wrote: So I tried my solution of deleting and then re-adding each object (row) in question.  Didn't work

[sqlalchemy] Money data type for Postgres

2010-12-18 Thread Eric Ongerth
Postgres deprecated the Money data type around 8.2 but then brought it back with better support soon after (I think 8.3 or 8.4 and after). I found the following message on this group, where Mike welcomes anyone to just roll their own type stuff for it or possibly submit a patch.

[sqlalchemy] Re: Money data type for Postgres

2010-12-18 Thread Eric Ongerth
of the code so I keep falling back into the same mental orbit about it. Thanks in advance if you can help clear my view. On Dec 18, 1:15 pm, Eric Ongerth ericonge...@gmail.com wrote: Postgres deprecated the Money data type around 8.2 but then brought it back with better support soon after (I think 8.3

[sqlalchemy] Re: Money data type for Postgres

2010-12-18 Thread Eric Ongerth
Meanwhile... meh. I'll be more than happy to go with Numeric(16,2) as suggested by #postgresql. Should work fine and the only disadvantage is the most minor of semantic objections. On Dec 18, 1:57 pm, Eric Ongerth ericonge...@gmail.com wrote: Hmm, I read through all of the relevant files

[sqlalchemy] polymorphism where a child can have multiple values of polymorphic_id?

2010-11-21 Thread Eric Ongerth
I must be in a search blind spot, I'm having trouble finding references and examples for this pattern, though I feel certain I've seen examples around the sqlalchemy literature a couple of times before. I have a table of Companies, and then further tables of Manufacturer and Vendor info which

[sqlalchemy] Re: polymorphism where a child can have multiple values of polymorphic_id?

2010-11-21 Thread Eric Ongerth
:41 PM, Eric Ongerth wrote: I must be in a search blind spot, I'm having trouble finding references and examples for this pattern, though I feel certain I've seen examples around the sqlalchemy literature a couple of times before. I have a table of Companies, and then further tables

[sqlalchemy] Re: Two relationships with a same backref name. Is that (even) possible or I got everything wrong?

2010-11-12 Thread Eric Ongerth
on the opposite mapper. On Nov 12, 7:31 am, Hector Blanco white.li...@gmail.com wrote: 2010/11/12 Eric Ongerth ericonge...@gmail.com: Hi Hector, If I'm not mistaken, everywhere you wrote (MyObject.id==MyObject.containerId), you meant to write: (Container.id==MyObject.containerId). Ups... yeah

[sqlalchemy] Found an old This will raise an error in 0.6 warning still included in 0.6.5

2010-11-12 Thread Eric Ongerth
Just a heads-up: I was experimenting with various cascade options on mappers and came across the following warning: SAWarning: The 'delete-orphan' cascade option requires 'delete'. This will raise an error in 0.6. But I'm running 0.6.5. Maybe this warning message just never got updated since

[sqlalchemy] Re: Two relationships with a same backref name. Is that (even) possible or I got everything wrong?

2010-11-11 Thread Eric Ongerth
Hi Hector, If I'm not mistaken, everywhere you wrote (MyObject.id==MyObject.containerId), you meant to write: (Container.id==MyObject.containerId). Instead of the backref technique, why not just create the MyObject-- Container relationship a single time in your MyObject class. That should be

[sqlalchemy] Re: Odd many-to-one problem

2010-11-11 Thread Eric Ongerth
Mike, what you set forth is more of what I was actually trying to bring into the discussion (having used that same technique myself), rather than the link I gave above. I need to get more sleep and check my doc references more carefully! On Nov 11, 1:39 pm, Mike Conley mconl...@gmail.com wrote:

[sqlalchemy] Re: Odd many-to-one problem

2010-11-10 Thread Eric Ongerth
Hi Jonathan, Rather than create a specific backref for each subtype of deal, why not just continue with your basic 'deals' backref, then attach regular python properties to your Merchant class which return just the desired sub-deals. Something like: class Merchant(object): ... @property def

[sqlalchemy] Re: Odd many-to-one problem

2010-11-10 Thread Eric Ongerth
Good point, Sergey. Here is the relevant documentation regarding mapping attributes to selects: http://www.sqlalchemy.org/docs/orm/mapper_config.html?highlight=arbitrary%20selects#sql-expressions-as-mapped-attributes On Nov 10, 4:46 pm, Sergey V. sergey.volob...@gmail.com wrote: The twist is

[sqlalchemy] Re: Table Inheritance

2010-11-06 Thread Eric Ongerth
Well, not by exactly using SQLAlchemy's provided implementation of joined table inheritance, because it uses a discriminator column that only holds a single value. Of course it is possible to create more complex inheritance structures on your own, just without some of the polymorphic-loading work

[sqlalchemy] Re: Best way to get data from database

2010-10-29 Thread Eric Ongerth
I understand your question if you are getting different data from the server in the two database accesses. But if you are loading the exact same data twice for a page load, you should try to eliminate that redundancy instead of finding a plan to perform the redundancy in the best way. If it's

[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Eric Ongerth
Kevin, the default behavior is for relations to be represented by lists. If what you want is a tree structure where a directory can only have a single parent, you would use backref=backref(parentdir, uselist=False). Or at least that's how you'd do it in plain SA; i haven't used the declarative

[sqlalchemy] Re: returning values as a list of values rather than as list of tuples

2009-01-15 Thread Eric Ongerth
I've always thought this format for the list comprehension was particularly clean: result = [x for (x, ) in conn.execute(.).fetchall()] On Jan 15, 8:27 am, Faheem Mitha fah...@email.unc.edu wrote: On Thu, 15 Jan 2009, Matthew Zwier wrote: Hi Faheem, On Thu, Jan 15, 2009 at 11:05 AM,

[sqlalchemy] Re: SQLAlchemy Sphinx Documentation Preview

2008-12-06 Thread Eric Ongerth
for the changes. On Dec 6, 6:44 am, Michael Bayer [EMAIL PROTECTED] wrote: On Dec 5, 2008, at 11:00 PM, Eric Ongerth wrote: Oh yeah, and in Main Documentation (at least) you have some ul class=simple lists nested inside of blockquote elements, which is resulting in some of your lists being much

[sqlalchemy] Re: a-directional i.e. bi-directional m:m relations

2008-12-05 Thread Eric Ongerth
all I can. On Dec 2, 3:32 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Dec 2, 2008, at 5:54 PM, Eric Ongerth wrote: Now when I want to find out whether a Foo has a relation to another Foo, I have to check whether there exists any row in foo_relations that has the given Foo as either

[sqlalchemy] Re: a-directional i.e. bi-directional m:m relations

2008-12-05 Thread Eric Ongerth
simpler... quite the opposite. On Friday 05 December 2008 10:40:16 Eric Ongerth wrote: Thanks for the ideas.  I thought of all of the above.  The one I've been using is the accessor which unions together the necessary things.  My question came up when I wondered if there was some even

[sqlalchemy] Re: SQLAlchemy Sphinx Documentation Preview

2008-12-05 Thread Eric Ongerth
Mike, Gaetan's right -- I just viewed the site a day after you (Mike) said that the li issue had been fixed, but they're still too widely spaced for sure. There are several conflicting (well ok, inheriting/ overriding) settings of line-height across the various css files, and it does not appear

[sqlalchemy] Re: SQLAlchemy Sphinx Documentation Preview

2008-12-05 Thread Eric Ongerth
pages then my suggestion could be an addition instead of a replacement. On Dec 5, 7:48 pm, Eric Ongerth [EMAIL PROTECTED] wrote: Mike, Gaetan's right -- I just viewed the site a day after you (Mike) said that the li issue had been fixed, but they're still too widely spaced for sure

[sqlalchemy] Re: SQLAlchemy Sphinx Documentation Preview

2008-12-05 Thread Eric Ongerth
Oh yeah, and in Main Documentation (at least) you have some ul class=simple lists nested inside of blockquote elements, which is resulting in some of your lists being much farther indented than others, without a good visual reason why. Seems like the difference could be eliminated. I sent new

[sqlalchemy] a-directional i.e. bi-directional m:m relations

2008-12-02 Thread Eric Ongerth
I could use some insightful suggestions here: What do you think of this use case? Let's say I have a class Foo mapped to a table 'foos', and a many:many relation between these objects, stored in the table 'foo_relations'. columns on foos: id (Integer) data (Text) columns on foo_relations:

[sqlalchemy] Re: inferring object class/table directly

2008-12-02 Thread Eric Ongerth
def add_obj(session, obj): Check if object primary key exists in db. If so,exit, else add. pid = obj.id if session.query(obj.__class__).filter_by(id=pid).count(): print Patient object with id %s is already in db.%pid exit else:

[sqlalchemy] Session.delete_all()

2008-11-30 Thread Eric Ongerth
IMO there should be a delete_all() convenience method on Session, similar to what add_all() does, accepting an iterable as its parameter. Just to match up expected behavior with the existence of add_all(). Side note: in the current API docs, add() is separated from add_all() by an

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
is not as interesting as requesting a given feature's determinants. Eric On Nov 24, 11:51 pm, Eric Ongerth [EMAIL PROTECTED] wrote: Below, I have attached a working testcase.  It works, yes -- but my question is that I need to make an improved version of a particular method on one of my classes

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
on Itemtype: @property def full_heritage(self): On Nov 25, 12:42 am, Eric Ongerth [EMAIL PROTECTED] wrote: Unfortunately, I posted the wrong version of my Itemtype class above; fortunately it wasn't important for what I was trying to show.  Please replace class Itemtype with the following

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
, Itemtype.name.in_(targets.all() Now this machinery does exactly what I want. I look forward to showing you what it's really used for eventually. Ciao! Eric On Nov 25, 1:57 am, Eric Ongerth [EMAIL PROTECTED] wrote: Well!  I guess that's exactly why we post sometimes -- the process of producing the test

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
of problem. Will now respond to Svilen's post. Eric On Nov 25, 2:04 am, Eric Ongerth [EMAIL PROTECTED] wrote: Arghh.  Accidentally hitting 'Tab' in google groups takes you to the 'Send' button, then your next spacebar press prematurely sends your post. Ok, add the following property on Itemtype

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
nodes, with 10 values each, x100 changes each, for about 20sec, on a relatively slow machine / postgres. maybe we can work together to get something out of it. On Tuesday 25 November 2008 09:51:37 Eric Ongerth wrote: Below, I have attached a working testcase.  It works, yes -- but my

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
20sec, on a relatively slow machine / postgres. maybe we can work together to get something out of it. On Tuesday 25 November 2008 09:51:37 Eric Ongerth wrote: Below, I have attached a working testcase.  It works, yes -- but my question is that I need to make an improved version

[sqlalchemy] Selecting from a self-referential mapper: recursive joins?

2008-11-24 Thread Eric Ongerth
Below, I have attached a working testcase. It works, yes -- but my question is that I need to make an improved version of a particular method on one of my classes. The following model will probably explain itself for the most part. I'll let you read it first, then offer a few explanatory notes

[sqlalchemy] Re: dynamic columns

2008-11-18 Thread Eric Ongerth
A way to normalize this: article_table: id title_table: article_id = primary key, also = foreign key to article_table.id language title content_table: article_id = primary key, also = foreign key to article_table.id language content mapper(Article, article_table, properties={

[sqlalchemy] Python 2.6 includes sqlite3 2.4.1

2008-11-09 Thread Eric Ongerth
To whom it may concern: I noticed the following thread in this group (the only thing that came up when I searched for sqlite3 python 2.6): http://groups.google.com/group/sqlalchemy/browse_thread/thread/d6d691b53e93b5e5/78a57bae1aefd59d And then I found the following on the page for What's New

[sqlalchemy] Re: SQLAlchemy 0.5.0rc3 Released

2008-11-07 Thread Eric Ongerth
Mike. You have absolutely perfect spelling. Better than 99% of the population. But there is just this one, and only one, English word that you spell strangely. You consistently spell propagate as propigate. Is there any way we can get an i/a switch in there? p.s. - Major props on being

[sqlalchemy] Re: composite primary key/postgres

2008-05-13 Thread Eric Ongerth
So part of the problem is postgresql is autoincrementing where you do not want it to do so? I thought postgresql only autoincrements where your column is of type 'serial'. Is that not true? Or if so, you could use type 'integer' instead of 'serial'. There is also the possibility that the

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread Eric Ongerth
On Apr 16, 7:24 am, Michael Bayer [EMAIL PROTECTED] wrote: always use delete cascade in conjunction with delete-orphan. It doesnt make much sense to have delete-orphan only and not delete cascade. Oh wow. That clears up a few things for me. I don't remember ever seeing this (or at

[sqlalchemy] Connection Already Closed -- potentially incorrect error msg sometimes?

2008-03-09 Thread Eric Ongerth
I don't know if the following traceback, from my Pylons project, will shed light on this. But I have fixed the error that I'm about to mention, and it was not what it appeared, which makes me wonder if SqlAlchemy has a bug in its error reporting (or on the other hand maybe there's just something

[sqlalchemy] Re: Connection Already Closed -- potentially incorrect error msg sometimes?

2008-03-09 Thread Eric Ongerth
need to get to the bottom of, just wanted to hear someone's perspective on it. Thank you for supplying one. E On Mar 9, 10:55 am, Michael Bayer [EMAIL PROTECTED] wrote: On Mar 9, 2008, at 5:58 AM, Eric Ongerth wrote: Finally after enough hair loss, I stopped poring over the tracebacks shown

[sqlalchemy] Re: Intersect of ORM queries

2008-03-05 Thread Eric Ongerth
, Eric Ongerth wrote: Anyway -- so what would really clean it all up would be: session.query(A).filter(A.bs.contains(list_of_bs_being_sought)).all(). THAT would do exactly what I'm trying to accomplish. But it would require contains() to accept a list and know what to do with it. My

[sqlalchemy] Re: Has anyone implemented a dict of lists collection_class?

2008-02-16 Thread Eric Ongerth
again. On Feb 16, 2:23 pm, Eric Ongerth [EMAIL PROTECTED] wrote: Awesome -- Mike, that's a heck of a great response and I'll try it all out. But one quick reply to your very first comment, before I go out and do so. You wrote: quote Im not sure you're going to be able to use the collection

[sqlalchemy] Re: Has anyone implemented a dict of lists collection_class?

2008-02-15 Thread Eric Ongerth
, while only having zero or one single child Bar for some other Foo. There, I think that tells it more completely. Sorry for the metasyntactic variables. On Feb 15, 8:13 pm, Eric Ongerth [EMAIL PROTECTED] wrote: If anyone out there has already implemented a custom DictOfLists collection class to map

[sqlalchemy] Has anyone implemented a dict of lists collection_class?

2008-02-15 Thread Eric Ongerth
If anyone out there has already implemented a custom DictOfLists collection class to map scalar keys to lists of values, I would be grateful for the opportunity to avoid reinventing the wheel. If not, I guess I'll start working on it. I've experimented successfully with

[sqlalchemy] Re: Has anyone implemented a dict of lists collection_class?

2008-02-15 Thread Eric Ongerth
it too. What's the next step? On Feb 15, 8:21 pm, Eric Ongerth [EMAIL PROTECTED] wrote: In case I didn't make it clear enough -- I've already done the following: 'children': relation(Bar, collection_class=attribute_mapped_collection('foo'), backref=backref('parent', remote_side=[bars.c.id

[sqlalchemy] Re: Has anyone implemented a dict of lists collection_class?

2008-02-15 Thread Eric Ongerth
of it. On Feb 15, 11:41 pm, Eric Ongerth [EMAIL PROTECTED] wrote: Ok, I tried subclassing MappedCollection and it seems like I did all right with my made-up appender, remover, and iterator functions. At least I fixed various errors and got this to at least function as the collection_class

[sqlalchemy] Re: why this Query API?

2007-08-24 Thread Eric Ongerth
Search the discussion group archive for the phrase (in quotes) in place and take a look at some of the related discussions from late June. On Aug 23, 2:10 pm, Marcos Dione [EMAIL PROTECTED] wrote: hi, I'm rather new to SQLAlchemy, using version 0.3.x right now. I would like to know the

[sqlalchemy] Re: Group by? Still a problem

2007-06-27 Thread Eric Ongerth
On Jun 27, 4:34 pm, voltron [EMAIL PROTECTED] wrote: Could you point me to the url where this example is? I wonder why order_by and other things work with the ORM then and group_by left out Here is where to find the group_by method in the documentation: From the main table of contents,

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-23 Thread Eric Ongerth
On Jun 23, 6:18 am, Michael Bayer [EMAIL PROTECTED] wrote: im not sure if full outer join is really available on most databases. I'm confused by the inclusion of the word really there. Is it that some of them claim to support a full outer join but what they deliver is not really the right

[sqlalchemy] Re: Unit Of work seems to be calling save/delete twice

2007-06-21 Thread Eric Ongerth
Thank you. Glad it worked out easily. --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Unit Of work seems to be calling save/delete twice

2007-06-20 Thread Eric Ongerth
Hello, * Apologies if this is a duplicate -- I attempted to post a few hours earlier but the result vanished. Could be that the earlier effort went off as a direct email to MB, instead of a post to this group as intended. chris e posted about this topic in April and I was trying to respond on

[sqlalchemy] Re: How to catch a changed event in ORM

2007-06-20 Thread Eric Ongerth
On Jun 20, 12:45 am, Can Xue [EMAIL PROTECTED] wrote: I'm working in a GUI project and use the SQLAlchemy for ORM. Can anyone tell me how to catch a attribute changed event in SQLAlchemy so that application can update the UI automaticly. Thank you. -- XUE Can This may be more of a Python

[sqlalchemy] Re: Unit Of work seems to be calling save/delete twice

2007-06-20 Thread Eric Ongerth
p.s.: I'm curious whether this is the same issue mentioned in ticket 370, though that was apparently specific to Firebird's treatement of rowcounts; here I'm on postgresql 8.2. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: Unit Of work seems to be calling save/delete twice

2007-06-20 Thread Eric Ongerth
Thanks. I'll be getting back to this tomorrow too. Meanwhile: please note -- easily overlooked, item.current has uselist=False in its relation to Gearset because an item can only *currently* be involved in, at most, one set of items / one in progress reservation. However, item.history and

[sqlalchemy] UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
For reference: http://www.mail-archive.com/[EMAIL PROTECTED]/msg02239.html I found the above discussion when googling a ProgrammingError i've been getting with a polymorphic_union: quote sqlalchemy.exceptions.SQLError: (ProgrammingError) UNION types numeric and character varying cannot be

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Eric Ongerth
On Jun 6, 8:32 am, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 5, 2007, at 10:30 PM, Mike Orr wrote: I do think .append_whereclause should be changed to .append_to_where. A SQL statement can have only one WHERE clause; what you're actually appending is an AND operand. .append_to_where

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
So then I thought: maybe I just need to reflect the skiboots table and override the size column to the desired type? That would make sense... so I tried it, using the same script as above but adding the line autoload=True as the final clause in each Table definition. Now i'm getting a

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
oops, sorry -- I was adding my reply while you were still writing yours. --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
On Jun 6, 8:47 am, Michael Bayer [EMAIL PROTECTED] wrote: your size column differs in type. you cant create a UNION with differing types in the unioned queries. so it can either be both string, both numeric, or use distinct columns. Ah! Ok, if i was more experienced with unions/joins I

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
Yeah. My problem has been solved by altering the tables... skiboots.c.size is now skiboots.c.skiboot_size, and skis.c.size is now skis.c.ski_size. Is there a way I could avoid that, making use of the use_labels=True parameter on select()? I've been trying to work out how to rewrite my

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
Thanks for your responses, Mike. --~--~-~--~~~---~--~~ 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] Re: How to most effectively associate child objects to parents upon _init__ (lookup tables)

2007-06-05 Thread Eric Ongerth
Hi John, Check out the doc section entitled Mapping a class with table inheritance: http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_inheritance Although it's not the only way to do it, you might be interested in polymorphic multiple-table inheritance, which SQLAlchemy already

[sqlalchemy] Re: How to most effectively associate child objects to parents upon _init__ (lookup tables)

2007-06-05 Thread Eric Ongerth
What's more, I should have just said to look in your sqlalchemy subdirectory /examples/polymorph/polymorph.py. I forgot that's where I learned the above techniques a month ago... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: PROPOSAL: whack query.select(), selectfirst(), selectone(), select_by(), selectfirst_by(), selectone_by(), get_by(), auto-join feature

2007-06-03 Thread Eric Ongerth
Well, that answers my next N anticipated questions on this list plus essentially every unasked-yet one in my backlog. These consistency/ predictability-of-syntax/redundancy points cut to the core of every issue I've had and/or every time I've had to hit the docs for more than a brief reminder.

[sqlalchemy] Re: bug in OrderedDict?

2007-06-02 Thread Eric Ongerth
, Michael Bayer [EMAIL PROTECTED] wrote: sounds like a bug. add a ticket and/or create a patch ! thanks. On Jun 2, 3:48 pm, Eric Ongerth [EMAIL PROTECTED] wrote: I noticed that if you pop() an item out of an OrderedDict, then ask the OrderedDict for its values(), you get a key error

  1   2   >