[sqlalchemy] Re: Bug? Polymorphic inheritance 100 times slower

2007-07-16 Thread svilen
On Monday 16 July 2007 09:59:41 Yves-Eric wrote: > Thanks for the explanation! The root of the issue is now very > clear. But are you saying that this is intended behavior? Was I > wrong in trying to use the session as an object cache? > > Now onto a possible solution or workaround... Please forgi

[sqlalchemy] Re: Multi-table inheritance and conflicting "id" columns

2007-07-13 Thread svilen
> > i played a bit with your thing... > > how do u expect the id column to appear in the Employee actualy? > > do u expect to get the base person' one, or the child one? or > > both? looking from the child, yes, the child one will obscure the > > parent one, but from the parent.. u'll never get th

[sqlalchemy] Re: Idea for 0.4: URI params / create_engine arguments

2007-07-09 Thread svilen
just to add an option, sometimes i solve such flat-namespace-collisions by adding inner level of syntax in argument values + parsing them, e.g. for command line strings: myapp mainarg1=v1 mainarg2=v2 sqlite='arg1:val1,arg2:val2'. this is somewhat ugly too, and is even uglier to extend to more

[sqlalchemy] Re: remember that polymorphic_union function ?

2007-07-02 Thread svilen
On Monday 02 July 2007 00:45:18 Eric Ongerth wrote: > Well, there ought to be more Bravos and Congratulations on this > thread. I only held back figuring others would pile on well > enough. Or maybe most of the polymorphists out there are gleefully > silent about what they're brewing up. > > Than

[sqlalchemy] Re: column_prefix with synonym

2007-06-29 Thread svilen
> if youre trying to lock down __dict__ and all that with magic, i > think you need to instead get better users :). its python, its > unrealistic to try to make a java-sandboxlike application that cant > be messed with. stop with this java labeling. think wider. java is just some (poor) language

[sqlalchemy] Re: BETWEEN in where clause?

2007-06-29 Thread svilen
the between should be in the where clause, NOT the columns that u fetch. Read about select() and how to specify columns and how to specify where's.. > Thanks for your reply,now I dont have errors, but the results are > unexpected, I have a list of booleans if I iterate through the > result ins

[sqlalchemy] Re: Future of migrate project

2007-06-28 Thread svilen
lets think my real world. i build a (very) complex tree of objects - the model of the application data and relations within. i express this model in some "language", implicitly or explicitly, then, automaticaly (or almost-), map this model into set of db tables, constraints etc. and this is do

[sqlalchemy] Re: cascade="all, delete-orphan" => FlushError, instance is an unsaved, pending instance and is an orphan

2007-06-28 Thread svilen
On Thursday 28 June 2007 16:16:09 znerol wrote: > Hi All > > Yes, i know, there is a FAQ-entry and i realized that this issue > was discussed before. Regretably i'm not able to make things work > with a one-to-many relationship using cascade="all, delete-orphan". > Now i discovered that even the e

[sqlalchemy] Re: column_prefix with synonym

2007-06-28 Thread svilen
> > I don't want override. My underlying goal is to make MyDate > > readOnly. As mapped attributes are already properties, it would > > be great to be able to > > 'declare' the readonly behaviour in the mapper. > > id say this is out of scope for mapper. id favor adding a > "property" argument to

[sqlalchemy] Re: Relation ends up as a one-to-one, not a one-to-many

2007-06-26 Thread svilen
it might be stupid, but did u try use_list=True ? --~--~-~--~~~---~--~~ 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,

[sqlalchemy] Re: advanced mapping help

2007-06-26 Thread svilen
> The mapper expects a > class, but I can't define Content before ContentCollection and > ContentCollection before Content... > whhy? SA-wise u have no problem: class X: pass class Y: pass mapper(X, ... y=relation(Y,...) ... ) mapper(Y, ... x=relation(X,...) ... ) The problem might be only in y

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-26 Thread svilen
> > http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_ > >data/17/4047/index.html > > I have to say I've seen better writeups on this topic - so be > warned :) that looks very much like '1st 5 things i found about recursive data'. > Choosing a strategy for storing hierarchical data

[sqlalchemy] Re: session.clear() not clearing cascaded items?

2007-06-21 Thread svilen
> That is, in my case, lifetime of objects is much longer that > lifetime of all database-and-related stuff - and seems this is not > expected pattern of usage. more questions on the theme. What is the expected sequence / lifetime / pattern-of-usage for engine, metadata, mappers, and finally, my

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

2007-06-20 Thread svilen
> > 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 question, because it is not > s

[sqlalchemy] Re: session.clear() not clearing cascaded items?

2007-06-20 Thread svilen
i think i found something... i am doing testing about these links and nodes. For each testcase i have one constant set of nodes, and then trying different scenarios with various combination of links. Each scenario creates all database stuff a new - db, metadata, mappers, session - and after te

[sqlalchemy] session.clear() not clearing cascaded items?

2007-06-19 Thread svilen
g'day i have Links, pointing to Nodes. Adding just Links to session + flush() works as expected - both Links and Nodes got saved. Doing session.close() although does not always detach all related objects, i.e. sometimes some Nodes stay with _session_id on them after session is long gone. "f

[sqlalchemy] Re: Mapper with relation/custom join condition fails

2007-06-19 Thread svilen
> > > Perfectly. Although all the hassle makes me think even harder > > > if there is really no other way of connecting these two > > > database tables. A casted join with string comparison gets > > > dirtier every time I look at it. :( > > > > excuse me if it sounds dumb... what about a middleman

[sqlalchemy] Re: How to map a Selectable such that objects can be created/inserted, updated, and deleted?

2007-06-18 Thread svilen
mapper() has a selectable= argument, go read about it. it can do just about anything u fancy. > Is there a way to create object mappers with "bean managed > persistence", as the Java folks would call it? What I would like to > do is to map a class to a Selectable such as a join. Now when an > ob

[sqlalchemy] autocloning vs returning self+explicit clone()

2007-06-08 Thread svilen
avoid such mess - if u wanna clone, please say it... ciao svilen --~--~-~--~~~---~--~~ 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 unsubsc

[sqlalchemy] Re: Experimenting with more than one level of inheritance.

2007-06-07 Thread svilen
what is your hierarchy? why Boss' mapper inherits from person's one, and not from manager's one? On Thursday 07 June 2007 19:56:30 Daniele Varrazzo wrote: > Hello, > > i'm trying to generalize the examples in the documentation about > multiple table inheritance, namely adding a `Boss` subclassin

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

2007-06-06 Thread svilen
On Wednesday 06 June 2007 19:03:44 Eric Ongerth wrote: > 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

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

2007-06-06 Thread svilen
> While those who prefer the latter can do that, and if you really > need a copy: > q = q.clone().order_by(...) "explicit is better than implicit" is one rule that may apply here. Not that i enslave myself with those rules but they do make sense in most cases in the long-run. Michael, u hol

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

2007-06-06 Thread svilen
copy", rather than > mucking things up with removal code. One of the aims here is to > simplify the API, and IMO adding removal code works against that. > > On 6/6/07, Marco Mariani <[EMAIL PROTECTED]> wrote: > > svilen ha scritto: > > > because q1 with the order is _

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

2007-06-06 Thread svilen
> svilen ha scritto: > > on a side note, here or for the query(), once i add .order_by() > > and similar, will be a possibility to remove/cancel them? > > e.g. .order_by(None) - similar to .join(None)? > > > > or should i keep a copy at the point before adding

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

2007-06-06 Thread svilen
on a side note, here or for the query(), once i add .order_by() and similar, will be a possibility to remove/cancel them? e.g. .order_by(None) - similar to .join(None)? or should i keep a copy at the point before adding .order_by()? e.g. i want: q1 = query.filter( ...).order_by(z)#the fi

[sqlalchemy] Re: Changing my SQLAlchemy include point

2007-06-04 Thread svilen
according to some new "bright" python idea, .eggs override PYTHONPATH. so eiter kill the .egg. There was some thread about this before, search for PYTHONPATH in the group... On Monday 04 June 2007 19:36:32 Paul Kippes wrote: > First, let me admit that I'm not an expert at Python. > > I'm trying

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

2007-06-04 Thread svilen
On Monday 04 June 2007 18:03:05 Rick Morrison wrote: > > Well, I don't really see the connection between .scalar() and > > .list(), other than they are kind of antonyms, but FWIW I always > > thought that .list() was an odd duck anyway, seeing as how the > > arguably more Pythonic list(query) work

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

2007-06-04 Thread svilen
all seems ok. and ORM will become looking less SQLish (as .select being the most SQLish word IMO) --~--~-~--~~~---~--~~ 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: pattern about nested transactions?

2007-05-23 Thread svilen
changed stuff in memory (and simulate by hand the sql-sub-selects over relations).. And in worst case the parent-child is a tree, and the levels there are unlimited... > On 5/23/07, svilen <[EMAIL PROTECTED]> wrote: > > howdy. > > here the use case. > > i have objec

[sqlalchemy] pattern about nested transactions?

2007-05-23 Thread svilen
howdy. here the use case. i have object Parent, which has relation to many objects Child. so, in UI, i have dialog editor for the Parent object, which has some direct attributes (name, age, etc), and some list of Children. Adding a Child to the list, or editing attributes of existing child, is

[sqlalchemy] Re: InstrumentedList in a boolean context

2007-05-22 Thread svilen
but sets would work only if your collection is uniq --~--~-~--~~~---~--~~ 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,

[sqlalchemy] Re: InstrumentedList in a boolean context

2007-05-22 Thread svilen
> Anyway, I've used sorted(MyInstrumentList...) == > sorted(MyInstrumentList2 or MyTuple or ...) ... which works :-) using sets() would be much faster/cheaper.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlal

[sqlalchemy] Re: Catching username password errors

2007-04-23 Thread svilen
and the exception traceback is? also, do provide something functional as tryout-case. On Monday 23 April 2007 16:54:40 Koen Bok wrote: > I am trying to catch username password errors to show in the > interface. But somehow I cannot catch the exeption. I wrap > everything in a try except, but the

[sqlalchemy] Re: @property

2007-04-18 Thread svilen
when u want it calculated? - just after load - just before save - if not set - always??? maybe use another attribute (_score) to store the value, map that one to table's column (either through mapper's property name or column's key), and let the score() either return _score if set or calc a

[sqlalchemy] Re: lower / upper case

2007-04-18 Thread svilen
there was some thread about this 2week ago or so, look for ILIKE On Wednesday 18 April 2007 14:58:41 Disrupt07 wrote: > I have a users table and I want to query the usernames column. I > want my query to ignore the upper/lower casing. > > So the following searches should all match "John": "joh

[sqlalchemy] Re: sqlalchemy limit by clause

2007-04-16 Thread svilen
default of limit is None. All those query.select arguments go in a orm.query.QueryContext() do see its __init__ for which arg has what default. On Tuesday 17 April 2007 09:31:04 Disrupt07 wrote: > I am defining my result list the following way: > > result = queryobject.select(mytable.c.columnname

[sqlalchemy] Re: Child to parent - Uni-directional relationships - Is that supported ?

2007-04-13 Thread svilen
> I have a Parent - Child (1:N) relationship between Class and Exam > table. > > Class -> Exam > 1 :N > > Now since a "Class" could have millions of "Exam" I don't want have > an attribute on Class called exams. Instead I only want an > attribute on "Exam" to the parent "Class". > > C

[sqlalchemy] Re: Many to many optimization

2007-04-12 Thread svilen
sorry, ignore this, started a new thread --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [EMAIL PROTECTED] To unsubscribe from this group, send email to [EMAIL

[sqlalchemy] many2many: how to copy one object's relatives to another object ?

2007-04-12 Thread svilen
how do i copy one object's relatives to another object, and if possible without loading them all? 1. user1.addresses = user2.addreses does not work, it makes them share the same InstrList 2. user1.addresses = user2.addreses[:] does work, but fires a full query (maybe with obj-instantiation) T

[sqlalchemy] Re: Many to many optimization

2007-04-12 Thread svilen
while on the same subject, how do i copy one object's relatives to another object without loading them all? user1.addresses = user2.addreses does not work, it makes them share the same InstrList user1.addresses = user2.addreses[:] does work, but fires a full query (maybe with obj-instantiatio

[sqlalchemy] Re: IN() bug bit hard

2007-04-12 Thread svilen
how about whatever.in() -> (whatever and False) maybe problem with Null then? On Thursday 12 April 2007 18:23:38 Michael Bayer wrote: > On Apr 12, 2007, at 9:46 AM, Ants Aasma wrote: > > On Apr 12, 1:59 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > >> agreed, as long as we know that saying "som

[sqlalchemy] Re: sqlalchemy.orm.attributes.InstrumentedList

2007-04-12 Thread svilen
same way, recursively: check 1st element if mylist and isinstance( mylist[0], yourlisttype): ... or check all elements, or... On Thursday 12 April 2007 17:52:28 Disrupt07 wrote: > Thanks. 'if isinstance(your_object, > sqlalchemy.orm.attributes.InstrumentedList):' was helpful to me. > > Now I w

[sqlalchemy] Re: IN() bug bit hard

2007-04-12 Thread svilen
just my point of view: generatively, i would probably do .in_( somelist ), where somelist is a variable, and it will work fine until that list gets empty. If that happens frequently, okay, i'll know soon about it and fix it/avoid it, but if it's once in a blue moon, u'll get one more disappoint

[sqlalchemy] Re: [PATCH] Filtered one_to_many relationships (Experimental)

2007-04-11 Thread svilen
is from_attr makeing sense for plain atributes, e.g. integers ot whatever? if no, maybe choose something like from_relation or filter_relation or filter_relation_tomany or similar if it is expected to only work over relations - and multiple-instances relations; i.e. it is useless over single

[sqlalchemy] Re: [PATCH] Filtered one_to_many relationships (Experimental)

2007-04-10 Thread svilen
can u give some exampe, how this is supposed to be used (finaly)? as relation and/or directly as Query() On Tuesday 10 April 2007 17:22:45 Gaetan de Menten wrote: > On 3/31/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > On Mar 31, 2007, at 1:17 PM, Gaetan de Menten wrote: > > > That's approxima

[sqlalchemy] Re: association obj/proxy

2007-04-06 Thread svilen
> seems this is the month of the many2many relations ;-) more on the theme: many2many i have a association of 3 tables, A,B,C. one of them (C) may not be present in all assoc_items. So that column has nullable=True. The problem is: adding associations to A-objects and saving them works; but re

[sqlalchemy] Re: global session object OR create and flush when required?

2007-04-06 Thread svilen
see this: ttp://www.hibernate.org/hib_docs/v3/reference/en/html/ transactions.html#transactions-basics-issues (whole thing actualy) and decide for your case... > Hi Guys, > > I have a web application wherein ORM session object is created per > HTTP request and flushed before sending the response

[sqlalchemy] Re: FlushError ("unsaved, pending instance and is an orphan")

2007-04-05 Thread svilen
what's your mappers? many2one/one2many relations etc? > I expected that I can create a parent-child link either from parent > to child (by appending to ranker.results) or from child to parent > (as above), but apparently the latter doesn't seem to work. Is this > the case or something else is wro

[sqlalchemy] Re: association obj/proxy

2007-04-05 Thread svilen
here's what i did and it seems to work: class _Empty: pass class Base4Association(..):#the base for assoc_objects ... class MyCollection( list): factory = None def append( me, obj =_Empty, **kwargs): if obj is _Empty:#marker for notset; else just use i

[sqlalchemy] association obj/proxy

2007-04-05 Thread svilen
soc.object is __setitem__, but there's syntacticaly no way to pass **kwargs there - unless called explicitly as xxx.__setitem__(...). ciao svilen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy"

[sqlalchemy] Re: multiple table inheritance problem

2007-04-04 Thread svilen
> > if u have different attributes for different Content subtypes, > > then that means subclasses and eventualy polymorphism. Or u go > > the single_typee (singletable) way, and put all stuff in Content, > > and just check for presence/absence of some attributes. > > yep I have different attribute

[sqlalchemy] Re: multiple table inheritance problem

2007-04-03 Thread svilen
> Julien Cigar wrote: > > Another quick question, relative to multiple inheritance. > > Is it common to keep a back reference to the parent class within > > the child class ? u mean theclass.__bases__? or what? > > The idea behind this is that I want to be able to retrieve the > > child from the

[sqlalchemy] Re: Many to many optimization

2007-04-02 Thread svilen
> After getting the results, i will filter them with Python filters, > as i don't know how to filter many-to-many queries directly. > > Should i somehow make custom queries that handles many-to-many > relationships etc. or is there something else i'm missing that > makes the system slow? I have ra

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-20 Thread svilen
one. > yeah sorry I can conceive of a potential pattern that would raise > this issue but im not able to create a mapping/scenario that > illustrates it. see if you can get me something on this. > > On Mar 19, 2007, at 6:49 AM, svilen wrote: > >> Michael Bayer wrote: &

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread svilen
> Michael Bayer wrote: > > So you can take the post_update out and update to rev 2424. > i have a problem with this 2424, before that was ok. As i can't separate a short case now, here the conditions: multi-table-inheritance, polymorphic. Nothing else too fancy. table_Entity has primary db_id,

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread svilen
one thing u can do is to replace some/all {} dicts with util.OrderedDict (and util.Set with util.OrderdSet) - including your owns!. u would be able to compare things easier then. or, try going backward to some rev that works, and check changes inbetween. > Hi, > > I'm having a problem where t

[sqlalchemy] Re: Making msg board

2007-03-15 Thread svilen
use table.alias() for one of the roles - or for both. > Hi, > > I doing a msg board with nested sets as descrived on > http://dev.mysql.com/tech-resources/articles/hierarchical-data.html > > I'm not sure how to do a statement like this in sqlalchemy: > > SELECT node.id, node.topic, node.content >

[sqlalchemy] Re: how to sum path in a tree?

2007-03-15 Thread svilen
ad all of it, compute somehow and store just the query-results for future direct reference/query. Which is more or less the same thing as above, just going one step further. > On Mar 15, 2007, at 10:25 AM, svilen wrote: > > There is some graph - represented as edges in some assoc.table,

[sqlalchemy] how to sum path in a tree?

2007-03-15 Thread svilen
There is some graph - represented as edges in some assoc.table, and they having some associated item with them (e.g. weight or length). Is it possible to calculate the overall lenght of path from node to node (if there is a path at all) in SQL? Finding if there is a path in the graph from node

[sqlalchemy] Re: DynamicMetaData question

2007-03-14 Thread svilen
> On Mar 13, 11:59 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote: > > I only discovered (or at least understood) this thread localness > > of DynamicMetaData, and honestly, I don't understand in what case > > it can be useful. It seems like the thread localness is limited > > to the engine con

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread svilen
This is the db-file size, which is actual DB-implemenation detail, and which will probably only grow up - depends on the particular db u have. There are many strategies, like paging etc. e.g. some DBs require a whole partition just for themselves - dont even think of shrinking those... See you

[sqlalchemy] Re: query on self-referencing polymorphic mapper

2007-03-05 Thread svilen
ok, that solves some things, i won't need those ultra-explicit selects() now. The other problem remains: union's mechanism for corresponding_column() takes ownership of all columns mentioned in the WHERE, regardless if they are from a table within the union/join, or in alias of that table. i.

[sqlalchemy] Re: query on self-referencing polymorphic mapper

2007-03-02 Thread svilen
> > hi. > > i have the case of polymorphic mapper referencing itself (or > > other of it's sub-class objects), and i want to query/filter on a > > value of the referenced object. > > e.g. all people who have friends of age > 25. > > these are highly highly complex queries and im not sure if the >

[sqlalchemy] Re: prettyprint sql

2007-03-02 Thread svilen
done, ticket 497 > > are we talking about adding a couple of "\n"s around ansicompiler > > ? sure. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@

[sqlalchemy] prettyprint sql

2007-03-01 Thread svilen
i have made a hack to make the sql/echo look somewhat better - level-indented + more line-separations. it auto-applies itself over the sqlachemy at runtime. usage: just import sahack4src e.g. SELECT pu_human.address_id AS pu_human_address_id, FROM (SELECT person.address_id AS address_id, .

[sqlalchemy] query on self-referencing polymorphic mapper

2007-03-01 Thread svilen
hi. i have the case of polymorphic mapper referencing itself (or other of it's sub-class objects), and i want to query/filter on a value of the referenced object. e.g. all people who have friends of age > 25. if i use direct the leafs of the hierarchy, that works: #case 1 t1 = table_human.ali

[sqlalchemy] Re: rev2362 fixes one thing and breaks another

2007-02-28 Thread svilen
> like this one...this does your generating thing. but much easier > to understand, since the actual "test" is clearly spelled out: > > http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/test/orm/ > abc_inheritance.py does that work under postgress? i mean the duplicating id-column issue,

[sqlalchemy] Re: rev2362 fixes one thing and breaks another

2007-02-28 Thread svilen
i think i found the culprit. i was trying this: if u replace the B-join  select( [table_A, table_B.c.dataB], table_A.c.atype == 'B', from_obj= [join( table_A, table_B, table_B.c.db_id == table_A.c.db_id, )], ) with the simpler  join( table_A, table_B,

[sqlalchemy] Re: rev2362 fixes one thing and breaks another

2007-02-28 Thread svilen
ok, here the cleaned case. Problem appears if A->B->C, A references B, B-mapper is polymorphic too, and there are 3 instances saved - A,B,C. It is similar as in http://groups.google.com/group/sqlalchemy/browse_thread/thread/5f05c11e3c168fb5/3c956e71dc724214#3c956e71dc724214 but there the lazy-

[sqlalchemy] Re: how to avoid saving certain class

2007-02-28 Thread svilen
> > i want to use the mapper in readonly manner. > > Any idea how to disallow this in most effective manner? > > I've been looking for this feature several weeks ago. You can have > a look at this thread (end of thread): > > http://groups.google.com/group/sqlalchemy/browse_thread/thread/79f1 >70e

[sqlalchemy] how to avoid saving certain class

2007-02-28 Thread svilen
g'day. i have class that is intermediate in the hierarchy, i.e. it is used for polymorphic loading BUT instances of _exactly that class should never be saved. i.e. i want to use the mapper in readonly manner. Any idea how to disallow this in most effective manner? e.g. assert somewhere at wh

[sqlalchemy] Re: references to polymorphic concrete-inheritance

2007-02-22 Thread svilen
uot; ) AS pu_b WHERE pu_b."linkA_id" = pu_b.db_id ORDER BY pu_b.oid IMO the last WHERE would need a second FROM entry but it has only one?? > On Feb 21, 2007, at 3:02 PM, [EMAIL PROTECTED] wrote: > >> id use an association table with its own entity to make things > >> ea

[sqlalchemy] lazy reference to polymorphic mapper fails

2007-02-21 Thread svilen
g'day some more. This time about table-inheritance, 3 levels - C inherits B inherits A, and A.linkA references to B (and subclasses). It is possible that something is wrong in the way i'm defining these... the B'part of the polymunions is according to your advice some time ago, to avoid duplica

[sqlalchemy] references to polymorphic concrete-inheritance

2007-02-21 Thread svilen
g'day. How one can make such thing as a reference to concrete-inherited polymorphic mapper? e.g. if there are just two, A and B, B inherits A, both have full concrete tables. A has polymorphic mapper. If both tables have separate primary ids, they will overlap as values - table_A.id=1 for som

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-21 Thread svilen
> the current error message is: > > raise exceptions.ArgumentError("Cant determine > relation direction for relationship '%s' - foreign key columns are > present in both the parent and the child's mapped tables. Specify > 'foreign_keys' argument." %(str(self))) > > are u on trunk

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
> > using the "foreignkey" parameter > > which is both deprecated and also more or less mutually exclusive > > with "remote_side". > specifying foreign_keys explicitly, _and_ remote_side does work. here the last fixed variant. but if u comment out foreign_keys and lave only remote_side, in cases

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
> using the "foreignkey" parameter > which is both deprecated and also more or less mutually exclusive > with "remote_side". how do u mean mutualy exclusive - so i don't need to specify that foreign*key* stuff if i do specify remote_side? or there are cases where it is needed? i'll try.. --~--~

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
ulfilling its legacy > behavior so ill try to fix that, but if you use foreign_keys (or > nothing) for now itll work. > > On Feb 20, 2007, at 4:39 AM, svilen wrote: > > something with lazy-relations, self-referential, but pointing to > > another instance, not to _itself_. Ha

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
sorry, on more file needed > something with lazy-relations, self-referential, but pointing to > another instance, not to _itself_. Happens regardless of > inheritance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
And another one - at same revision - maybe same thing? IMO the UPDATE for a lazy post_update relations gets the dbapi values swapped, e.g. (sqlite) rev2308: SA: INFO UPDATE "Person" SET friend_id=? WHERE "Person".db_id = ? * SA: INFO [2, 7] rev2309-2344: * SA: INFO UPDATE "Person" SET fr

[sqlalchemy] rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
something with lazy-relations, self-referential, but pointing to another instance, not to _itself_. Happens regardless of inheritance. 2308 is all-ok, 2344 is same as 2309. hmm, what should i do to this all-combination test, so it gets included it in the testsuite? i.e. make it unittest-like bu

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
Here, no need to touch Property.get_join(), only a new join_via(): def join_via( keys, mapper): clause = None c = None self_select_table = None for key in keys: prop = mapper.props[key] try: c = prop.get_join() #SA rev<2285 except TypeEr

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
no, wrong, there's more to it; each level's parent.table should be the previous level's aliased table... > i think i managed to construct a proper thing, changing > PropertyLoader.get_join(), and made my own join_via(): --~--~-~--~~~---~--~~ You received this mes

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
. The last-referred-aliased-table picking above is flaky, cannot make anything better for now - unless interface of get_join() is also changed to return that explicitly.. Any idea to incorporate such/similar functionality in SA? Probably with more stuff going on around polymorph-un

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
give those persons which persons.friend.friend.friend.name == 'pipi' > On Feb 15, 9:41 am, svilen <[EMAIL PROTECTED]> wrote: > > and, how u make the (3) or (4) work? > > aliasing the table.column in the comparison does not help.. it > > should be aliased somehow inside the join also

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
and, how u make the (3) or (4) work? aliasing the table.column in the comparison does not help.. it should be aliased somehow inside the join also.. Here a simpler case, without the inheritance. 3 and 4 do not work here too - one does exception, other return nothing. maybe express the query

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-15 Thread svilen
can i make the mapper.someproperty.get_join() to return aliased version somehow? maybe copy the mapper? > taking a look, i think what you should do is use an alias of the > table_Employee in your queries. since the engineer mapper is using > joined table inheritance, the default table_Employee

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-14 Thread svilen
whole polymorphic_union - which isn't needed (ehm, > thats 2 pages sql for 10 classes). > Is there a way to hint these not to do it, e.g. some mapper/query > option or specify different mapper or something? > > i will probably generate clauses using (2) anyway, but just in c

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-14 Thread svilen
y, but just in case i want to have a door open... > On Feb 13, 11:17 am, svilen <[EMAIL PROTECTED]> wrote: > > hi. > > > > Here is a simple case which does not work - or i cannot figure > > out how to make it work. > > 'give all engineers which have he

[sqlalchemy] query on table-inheritance, self-referencing mappers

2007-02-13 Thread svilen
hi. Here is a simple case which does not work - or i cannot figure out how to make it work. 'give all engineers which have helper employee of age >=20'; where Engineer inherits Employee via table-inheritance. i've tried multiple ways to achieve the result - neither works, in different ways. S

[sqlalchemy] Re: Object-oriented engine?

2007-02-09 Thread svilen
re like a language and less like bunch of lowlevel getattr/getparents()-calls? i guess u'll have to make it on your own... btw There was some versant python wrapper here, ancient (1999): http://starship.python.net/crew/jmenzel/ The link maybe dead, i have the .tgz (37K) if u want it as starting

[sqlalchemy] Re: Dynamically adding MapperExtension

2007-02-09 Thread svilen
> question. > > Lets say I have a series of table definitions, and a series of > objects linked to the tables with a bunch of mappers. > > First question: Is there a way to get from the table definitions > in the metadata to the Mapper? For simple table==class, the link is 1:1. For multi-table-

[sqlalchemy] Re: Object-oriented engine?

2007-02-09 Thread svilen
how much OO u want? There is SA, which has ORM layer over sql, so can become a somewhat object persistency. There are turboentity/activemapper, currently joining together, which are simple declarative layer on top of SA. Then here is this 'sawrapper' of mine, which is also declarative and wide

[sqlalchemy] Re: SQL echoing?

2007-02-09 Thread svilen
set metadata.engine.echo=False ? which revision are u using? eventuly check for remaining print's somewhere: grep -R "^ *print" /sqlalchemy or grep -R "^[^#]*print" /sqlalchemy > One of my scripts keeps printing out a bunch of LAZY CLAUSE > statements and I'd like to know how to turn t

[sqlalchemy] Re: FlushError: Can't change the identity of instance

2007-02-08 Thread svilen
> >somehow u've managed to have 2 copies of same persistent-object - > >which should not happen; how did u get it? > > I don't know. can u prepare some short testcase ? and/or wait for those who know... > >one has unicode-string '6', another one has int 6 instead - some > >conversion failing? > >

[sqlalchemy] Re: FlushError: Can't change the identity of instance

2007-02-08 Thread svilen
somehow u've managed to have 2 copies of same persistent-object - which should not happen; how did u get it? one has unicode-string '6', another one has int 6 instead - some conversion failing? > Could please, someone tell me what the following error means? > > FlushError: Can't change the iden

[sqlalchemy] Re: making crud with assign_mapper

2007-02-07 Thread svilen
> If you have the time and know how, do you know what the efficient > way to iterate through all the class definitions in a module would > be to grab all the classes that have a certain member? import module for k,v in module.__dict__.iteritems() if isinstance(v,type): if issubclass(v, some

[sqlalchemy] Re: new setuptools vs local SA copy

2007-02-07 Thread svilen
u mean eggs will override pythonpath? that's bullshit! one more reasone for me to hate eggs... be them cockroach' or python ones... > as I have like 12 different SA directories which id like to jump > between without going through a distinct install for each one, im a > big fan of PYTHONPATH, an

[sqlalchemy] Re: inconsistent results between 2 testuites executions (SA 0.3.4)

2007-02-07 Thread svilen
> > Why not just use util.Dict (defaulting to dict) instead of {}? > > > > Then whoever wants, replaces that with Ordered one and voila, all > > things get repeatable, if a little slower. > > the ordering of the data sent to the sort should not affect the > outcome of the program. therefore its i

[sqlalchemy] Re: inconsistent results between 2 testuites executions (SA 0.3.4)

2007-02-06 Thread svilen
i mentioned this dictionary-order on my ramblings some weeks ago; then u didnt take it into account. i've managed here to get repeatable testing and SQL generation with hack-replacing many {} with ordered ones, but i don't like the solution. Why not just use util.Dict (defaulting to dict) ins

<    1   2   3   >