[sqlalchemy] Re: Intersect of ORM queries

2008-03-05 Thread svilen
pardon my sql-ignorancy, but cant u express this in just one expression? it should be possible, it is a graph/set arithmetics after all... mmh, (could be very wrong!) something like - get all rows that has some b_id from the looked list - group(?) somehow by a_id, and then finger the a_id

[sqlalchemy] Re: AuditLog my first attempt

2008-03-04 Thread svilen
On Tuesday 04 March 2008 12:34:11 Marco De Felice wrote: So after some coding and thanks to sdobrev previous reply I came up with the following mapperextension that allows for a client side update log to a different table (logtable name = table_prefix + original table name) with a

[sqlalchemy] some error at v4070

2008-02-11 Thread svilen
inheritances where the root-table is not included in the union (i.e. leafs only). If it gets included, the error goes away. i dont know, if it's the case that is too weird, i could workaround it possibly. svilen --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: building mappers for an existing database

2008-02-11 Thread svilen
On Monday 11 February 2008 16:07:03 Chris Withers wrote: svilen wrote: search the group for things related to migrate (i call it migrene :); there are 2 approaches: - make the db match the py-model - make the model match the db It's this 2nd one I'm asking about. Is sqlautocode

[sqlalchemy] Re: Search in object list by field value

2008-02-08 Thread svilen
On Friday 08 February 2008 14:26:04 maxi wrote: a) let SQl do it p1 = session.query(Person).filter_by(id==123).first() #see .filter_by syntax b) get all people, then plain python: for p in people: if p.id == 123: break else: p=None --~--~-~--~~~---~--~~

[sqlalchemy] Re: building mappers for an existing database

2008-02-08 Thread svilen
On Friday 08 February 2008 16:09:28 Chris Withers wrote: Hi All, Almost similar to my last question, how do you go about building mappers for an existing database schema? What happens if you don't get it quite right? :-S cheers, Chris search the group for things related to migrate (i

[sqlalchemy] Re: How to accomplish setup/run-app/teardown with mapped classes and sessions?

2008-01-23 Thread svilen
as class.__init (in orm.attributes.register_class) and is not cleared in clearmappers. for easy check, u can run your test 100 times and watch the memory used; if it grows then _something_ of all those above is not cleared. ciao svilen On Thursday 24 January 2008 00:00:52 Kumar McMillan wrote

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-15 Thread svilen
there, having None where missing. 0.4.3? On Monday 14 January 2008 18:56:16 svilen wrote: On Monday 14 January 2008 18:35:40 Michael Bayer wrote: On Jan 14, 2008, at 11:29 AM, svilen wrote: On Monday 14 January 2008 17:19:14 Michael Bayer wrote: On Jan 14, 2008, at 8:41 AM, svilen wrote: i have

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-15 Thread svilen
On Tuesday 15 January 2008 17:19:49 Michael Bayer wrote: On Jan 15, 2008, at 4:33 AM, svilen wrote: also, i dont see a reason for it not to work if the (A jon B join C) is a polymunion - all the same, all columns will be present there, having None where missing. 0.4.3? unlikely, I

[sqlalchemy] Re: Query object behavior for methods all() and one()

2008-01-14 Thread svilen
all() returns whatwever is there, 0, 1, n first() returns first if any or None one() asserts there's exactly 1 On Monday 14 January 2008 18:23:28 Adrian wrote: I am a bit confused by the behavior for the methods all() and one() if the Query would return an empty result set. In the case of

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-14 Thread svilen
On Monday 14 January 2008 17:19:14 Michael Bayer wrote: On Jan 14, 2008, at 8:41 AM, svilen wrote: i have, say, base class A, inherited by two children B and C. B has an attribute/relation 'address', A and C do not have it. So i had a query(A).eagerload( 'address') and that did work

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-11 Thread svilen
On Friday 11 January 2008 16:12:08 Alexandre Conrad wrote: svilen wrote: Here is the syntax followed by the generated query: query.filter(Catalog.c.id==CatalogChannel.c.id) WHERE catalogs.id = catalogs.id why u need such a query? that's exactly what (inheritance) join does

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-11 Thread svilen
On Friday 11 January 2008 13:58:34 Alexandre Conrad wrote: Hi, playing with inheritance, I figured out that an inherited mapped class passed to filter doesn't point to the correct table. I have 2 classes, Catalog and CatalogChannel(Catalog). Here is the syntax followed by the generated

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-11 Thread svilen
On Friday 11 January 2008 17:03:06 Alexandre Conrad wrote: svilen wrote: On Friday 11 January 2008 16:12:08 Alexandre Conrad wrote: Channel - Playlist - Media Channel - CatalogChannel(Catalog) - Media (Media has a fk to Catalog, not CatalogChannel) The only element I have, is playlist

[sqlalchemy] String - Text type deprecation

2008-01-09 Thread svilen
what it is about? i'm not much into sql types... isn't Varchar enough for a unsized/anysized String? btw, 'count * from ...' produces the warning for sqlite; a bindparam autoguesses a type_ of VARCHAR and for some reason the VARCHAR also needs length ??

[sqlalchemy] Re: Emptying out the session of new objects

2008-01-04 Thread svilen
On Friday 04 January 2008 14:44:32 Dave Harrison wrote: On Friday 04 January 2008 23:32:21 Alexandre da Silva wrote: Is there an easy way of flushing all objects that are categorised as new in the session ?? I think you can use session.clear(), it will remove objects from session,

[sqlalchemy] Re: get related table object via mapped class

2008-01-04 Thread svilen
On Friday 04 January 2008 18:54:29 Alexandre da Silva wrote: Hello all, is there any way to access class related by an relationship? sample: # Table definition ommited class Person(object): pass class Address(object): pass mapper(Person, person_table, properties=dict(

[sqlalchemy] Re: Conventions for creating SQL alchemy apps

2007-12-20 Thread svilen
some may-be-stupid answers: - see the number of lines per file - split it into app-field-related parts, not SA-arhitectural parts - hell, do as it is easier - start as one file, once u hit some limit of your nerve(r)s, split.. but do keep one single file as main entrance point On Thursday

[sqlalchemy] query.filter_or() ?

2007-12-20 Thread svilen
query.filter() does criterion = criterion new why not having one that does criterion = criterion | new ? its useful to have some query.this.that.filter.whatever.filter_or(...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] some error around trunk

2007-12-15 Thread svilen
seems something about .type vs .type_ or similar: Traceback (most recent call last): File tests/convertertest.py, line 152, in test4_balance_trans_via_prev_balance_date_subselect trans.c.date func.coalesce( sprev,0 ) File sqlalchemy/sql/expression.py, line 777, in __call__ return

[sqlalchemy] Re: Iterating over mapped properties

2007-12-11 Thread svilen
On Tuesday 11 December 2007 13:13:37 King Simon-NFHD78 wrote: Hi, I used to be able to iterate over mapper.properties.items() to get the name of each mapped property along with the object that implements it. However, in 0.4.1, trying to do this results in a NotImplementedError telling me to

[sqlalchemy] Re: Column defaults in MapperExtension.after_insert

2007-12-11 Thread svilen
This works nicely for attributes that I set directly. However, it breaks when it comes across a column that is defined as: sa.Column('date_created', sa.DateTime, default=sa.func.current_timestamp(type=sa.DateTime)) The attached script should show the problem. The

[sqlalchemy] Re: Design: mapped objects everywhere?

2007-12-10 Thread svilen
On Monday 10 December 2007 12:12:19 Paul-Michael Agapow wrote: Yowser. Thanks to both of you - that's exactly what I mean. Any pointers on where I can find an example of a class that is unaware if it is in the db? Or is there a good example of the second solution, of a single class that does

[sqlalchemy] Re: delete children of object w/o delete of object?

2007-12-06 Thread svilen
On Wednesday 05 December 2007 23:36:12 kris wrote: with sqlalchemy 0.4.1, Is there an idiom for delete the children of the object without actually deleting the object itself? I tried session.delete (obj) session.flush() # add new children session.save (obj) session.flush() But it

[sqlalchemy] clause with crossproduct of joined-inheritance

2007-11-26 Thread svilen
access to same base table coming from different subclasses - alias 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

[sqlalchemy] Re: filter_by VS python properties/descriptors VS composite properties

2007-11-20 Thread svilen
On Tuesday 20 November 2007 11:37:29 Gaetan de Menten wrote: Hi people, I have some classes with standard python properties which target another python object and also uses several columns in the database. I also got a global factory function to create an instance of that target object out

[sqlalchemy] Re: 2 questions

2007-11-13 Thread svilen
clarification for this below; i have non-ORM updates happening inside ORM transaction (in after_insert() etc). How to make them use the parent transaction? i have a connection there. and, why atomic updates also have with commit after them? or is this sqlite-specific? every CRUD

[sqlalchemy] ticket 819/r3762

2007-11-13 Thread svilen
what a coincidence, 2 days ago we stepped on this bindparam-types thing; table.some_decimal_column == decimal.Decimal(5) did not always work. now it mostly works, i think there is one more case that breaks for me: when the column itself is hidden in a function. e.g. table_A = Table(

[sqlalchemy] Re: 2 questions

2007-11-13 Thread svilen
On Monday 12 November 2007 23:11:25 Michael Bayer wrote: On Nov 12, 2007, at 2:07 PM, [EMAIL PROTECTED] wrote: hi 1st one: i am saving some object; the mapperExtension of the object fires additional atomic updates of other things elsewhere (aggregator). These things has to be

[sqlalchemy] Re: mapper/mapperExtension initialization order / mapper.properties

2007-11-08 Thread svilen
forget the instrument_class(). i do a separate MapExt, and append it to the mapper.extensions manualy. So if this post-mapper() append'ing does not screw things up, all else is ok. i have another option to forget the above auto-approach and add the extension separately, after the

[sqlalchemy] Re: r3727 / AbstractClauseProcessor problem

2007-11-08 Thread svilen
i dont really understand why u need the ACP being so different to plain visitor; i mean cant they share some skeleton part of traversing, while putting all the choices (visit* vs convert; onentry/onexit; stop/dont) in their own parts. After all, visitor pattern is twofold, a) Guide

[sqlalchemy] mapper/mapperExtension initialization order / mapper.properties

2007-11-08 Thread svilen
g'day. in the Aggregator i have mapper extension, that needs info from the mapper like local-table and mapping/naming of column properties. It used to hook on instrument_class() for that, but now the mapper.properties in its new get()/iterate() form is not available yet when mapper-extensions

[sqlalchemy] Re: Code Organisation

2007-11-07 Thread svilen
u can use the timephase-separation, i.e. declare vs runtime; i.e. use global scope in for B in A, but use runtime scope for A in B. modB.py: import A ... modA.py: def somefunc_or_method(): import B ... another solution is to have sort-of forward-text-declarations that at certain

[sqlalchemy] Re: r3727 / AbstractClauseProcessor problem

2007-11-07 Thread svilen
of ACP can locate things besides just plain Table, Alias and Column objects; it can locate things like Joins embedded in a clause which match the target selectable. On Nov 7, 2007, at 10:45 AM, svilen wrote: On Wednesday 07 November 2007 16:57:08 Michael Bayer wrote: On Nov 7, 2007, at 2:03

[sqlalchemy] Re: r3727 / AbstractClauseProcessor problem

2007-11-07 Thread svilen
Column userpics.uid Column userpics.state r3627: Column tags.tabl Column tags.oid Column movies.id Column tags.oid Column movies.id Column users.id Column userpics.uid Column userpics.state the 2nd tags.tabl is missing, hence the assertFails ciao svilen

[sqlalchemy] r3681/ session.save( smth_persistent) became error?

2007-10-31 Thread svilen
why is this so? i have bunch of objects, and i make them all persistent. then i have another bunch, some of them are noe, other are from above and i want this bunch to also became persistent. (If something there IS already persistent - so what, do nothing) how do i do it now?

[sqlalchemy] Re: r3681/ session.save( smth_persistent) became error?

2007-10-31 Thread svilen
On Wednesday 31 October 2007 17:51:09 Michael Bayer wrote: also am considering taking save()/update()/save_or_update(), which are hibernate terms, into just add(). maybe ill put that in 0.4.1. why not save() - having the 'save_or_update' meaning? would anyone need the new explicit save() -

[sqlalchemy] couple of errors

2007-10-26 Thread svilen
)   File sqlalchemy/orm/strategies.py, line 553, in setup_query     value.setup(context, parentclauses=clauses, parentmapper=self.select_mapper) ... last two repeated ... ciao svilen --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: Feature suggestion: Description attribute in Tables/Columns

2007-09-17 Thread svilen
, and they already know their (DB) names. Thus u can have different layout of your documentation than what is in the source code. svilen On Monday 17 September 2007 16:07:15 Hermann Himmelbauer wrote: Hi, I am creating my database via SQLAlchemy, therefore I use several Column() objects

[sqlalchemy] Re: Automatically loading data into objects

2007-09-14 Thread svilen
On Friday 14 September 2007 14:41:14 Hermann Himmelbauer wrote: Hi, In one of my database tables I have a varchar that is mapped to an object with a string attribute. This specific varchar should however be represented by a certain Python object, therefore it would be very handy, if there

[sqlalchemy] Re: How to safely increasing a numeric value via SQLAlchemy

2007-09-11 Thread svilen
On Tuesday 11 September 2007 13:35:18 Hermann Himmelbauer wrote: Am Dienstag, 11. September 2007 10:54 schrieb svilen: in 0.4 there is atomic update, e.g. update set a=expression syntax is something like table.update( values=dict-of-name-expression ).execute( **bindings-if-any

[sqlalchemy] Re: Many-to-Many, Column not available

2007-09-11 Thread svilen
wild guess: do u need relations_table.id? rename/remove it On Tuesday 11 September 2007 12:34:47 KyleJ wrote: I get the same result with this in 0.3.10 and 0.4beta5 Basic idea: I have two tables which hold various data and a third table which let's different rows in each table be related

[sqlalchemy] _state and related

2007-09-10 Thread svilen
/limitations are documented somewhere. Another one is the ._instance_key that stays on the instance after orm is gone (the ._state will also stay). ciao svilen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Re: add condition over a classmethod

2007-09-10 Thread svilen
somethings' missing here.. whats the link classmethod - select - etc? do explain again/more... u mean the classmethod generates the filter-expression? whats the difference classmethod vs plainmethod here? all the same, just call it: self.myclassmethod(..) On Monday 10 September 2007 14:40:57

[sqlalchemy] Re: Many tables in eagerloading

2007-09-04 Thread svilen
On Tuesday 04 September 2007 17:12:26 Arun Kumar PG wrote: Good work svilan! couple questions from what you suggested: skipping creation of objects - only using the data, if time of creation gets critical. In my query wherein the eagerloading is being done on 8 tables if I manually run

[sqlalchemy] Re: How to construct a dialect-aware user type

2007-08-30 Thread svilen
IMO current way as of src (sorry i havent read docs at user level), u'll need two-side implementaion - one abstract SA, and one dialect-dependent. In each dialect, there are 2 mappings: one abstractSAtype-specificDialectType (look for something named colspecs), and another one used for

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread svilen
decimals.. u can use pickling? slower, yes. On Friday 24 August 2007 10:37:53 Florent Aide wrote: Hi, As far as I know, sqlite does not allow you to store decimal objects, only floats. Which really is not the same. If you really need decimals (ie: accounting books anyone ?) then you should

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread svilen
are storing amounts for accounting books... Florent. On 8/24/07, svilen [EMAIL PROTECTED] wrote: decimals.. u can use pickling? slower, yes. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] echo-es

2007-08-22 Thread svilen
in 0.3, one could do meta = MetaData( whatever, echo=True) later, early 0.4, the echo kwarg was gone, so it got less convenient, adding another line: meta.bind.echo = True As of latest trunk, neither works, one has to explicitly do meta = MetaData( create_engine(whatever, echo=True)) which

[sqlalchemy] Re: echo-es

2007-08-22 Thread svilen
Another thing, the dots that are produced by unittests magically disappear if meta.bind.echo = True, very interesting.. shoot me, thats my problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group.

[sqlalchemy] dbcook updated for SA 0.4

2007-08-21 Thread svilen
to 0.3.6... i still keep them all) The migration was not very easy thing, as dbcook uses a_lot of under-cover internalities from SA. svn co https://dbcook.svn.sourceforge.net/svnroot/dbcook/trunk/ ciao svilen --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
another thing noted, the collections instrumentation fails over old python classes (not inheriting object), e.g. class myX: ...whatever... it fails at _instrument_class(), because type(myX()) being type 'instance' is recognized as builtin, and apart of that the util.duck_type_collection()

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
_def _tidy(fn): ... #becomes global the only prerequisite for this is to rename __del() and __set() into _del /_set or else they get looked up as private-named identifiers (?? no idea why). ciao svilen --~--~-~--~~~---~--~~ You received this message because

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
a patch, it got even tidier ;-) - no more _tidy() calls, all automated. On Monday 20 August 2007 16:41:30 svilen wrote: a suggestion about _list_decorators() and similar. they can be easily made into classes, i.e. non dynamic (and overloadable/patchable :-). class _list_decorators( object

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
and no need for that __new__ replacement either - just use _list_decorators._funcs instead of _list_decorators() On Monday 20 August 2007 17:05:32 svilen wrote: a patch, it got even tidier ;-) - no more _tidy() calls, all automated. On Monday 20 August 2007 16:41:30 svilen wrote

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
On Monday 20 August 2007 17:29:52 jason kirtland wrote: [EMAIL PROTECTED] wrote: hi i need to have a list collection with list.appender (in SA 0.4 terms) that accepts either one positional arg as the value, or keyword args which it uses to create the value. Each collection instance

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
On Monday 20 August 2007 18:01:49 jason kirtland wrote: svilen wrote: a suggestion about _list_decorators() and similar. they can be easily made into classes, i.e. non dynamic (and overloadable/patchable :-). The stdlib decorators end up in a static, module-level dictionary that can

[sqlalchemy] query.select vs .filter + .from_statement

2007-08-16 Thread svilen
i have a premade filtering clause and give it to a query.select at runtime. Sometimes its a simple x == 13 expression, another time it is a full sql-construct like polymorphic_union(). in 0.3 all went into .select(), but in 0.4 these 2 kinds seems split between .from_statement and .filter. so

[sqlalchemy] Re: SQLAlchemy 0.4 beta2 released

2007-08-14 Thread svilen
performance-wise - do u have any test/target for profiling? else i can repeat some tests i did somewhen in february (if i remember them..) = while looking to replace all {} with dict/Dict(), i found some things. Here the list, quite random, probably some can be just ignored if not

[sqlalchemy] Re: autoload'ing metadata

2007-07-27 Thread svilen
On Friday 27 July 2007 12:44:49 Christophe de VIENNE wrote: 2007/7/26, [EMAIL PROTECTED] [EMAIL PROTECTED]: noone wanting to try autoload'ing nor metadatadiff? i am surprised.. Christophe, u can at least try how much autoload.py works like your autocode2 - i got lost with 'schema' vs

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-27 Thread svilen
one suggesstion / request. As your changing everything anyway, can u replace all important {} and dict() with some util.Dict, and set() with util.Set? util.Ones can point to dict/set. The reason is so they can be further globally replaced by user with OrderedOnes, for example to achieve

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-27 Thread svilen
here the changes i needed to get dbcook (abstraction layer over SA), and its tests going to some extent (70% - relations and expressions are broken): - BoundMetaData - MetaData - lots (15) - metadata.engine.echo=True - lots (14) Whats the difference between create_engine's echo=boolean and

[sqlalchemy] Re: a renaming proposal

2007-07-27 Thread svilen
On Friday 27 July 2007 11:44:43 Gaetan de Menten wrote: On 7/27/07, svilen [EMAIL PROTECTED] wrote: On Friday 27 July 2007 02:45:12 jason kirtland wrote: - Catalog: what is a sqlalchemy's metadata? jason a catalog of tables available in the database. to me it holds everything

[sqlalchemy] Re: autoload'ing metadata

2007-07-26 Thread svilen
On Thursday 26 July 2007 11:37:08 Marco Mariani wrote: [EMAIL PROTECTED] ha scritto: here some theory on comparing data trees, in order to produce the changeset edit scripts. http://www.pri.univie.ac.at/Publications/2005/Eder_DAWAK2005_A_Tr ee_Comparison_Approach_to_Detect.pdf The

[sqlalchemy] autoload'ing metadata

2007-07-25 Thread svilen
this is along the recent threads about metadata consistency between code and DB, and the DB-migration. Both these require a full metadata reflection from database. Here a version of autocode.py, hacked for couple of hours. It has more systematic approach, replaces back column types with SA

[sqlalchemy] Re: Choosing a few columns out a query object

2007-07-25 Thread svilen
from sqlalchemy import * metadata = MetaData() docs = Table('docs', metadata) docs.append_column(Column('DocID', Integer, primary_key=True)) docs.append_column(Column('Path', String(120))) docs.append_column(Column('Complete', Boolean)) class Doc(object): def __init__(self, id,

[sqlalchemy] Re: autoload'ing metadata

2007-07-25 Thread svilen
copying the structure of input db1 database into the output db2. ciao svilen this is along the recent threads about metadata consistency between code and DB, and the DB-migration. Both these require a full metadata reflection from database. Here a version of autocode.py, hacked for couple of hours

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-24 Thread svilen
On Tuesday 24 July 2007 16:22:43 Anton V. Belyaev wrote: Hey, I believe there is a common approach to the situation, but I just dont know it. Let say, I have some tables created in the DB using SQLAlchemy. Then I modify Python code, which describes the table (add a column, remove another

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-24 Thread svilen
On Tuesday 24 July 2007 17:30:27 Michael Bayer wrote: such a feature would make usage of table reflection, and then a comparison operation, along the lines of : ... assert t.compare(t2) yes i was hoping for such method (:-) And the best will be if it can produce a list/ hierarchy of

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-24 Thread svilen
assert t.compare(t2) yes i was hoping for such method (:-) And the best will be if it can produce a list/ hierarchy of differences, which then programaticaly can be iterated - and checked and resolved or raised higher. but why not just use autoload=True across the board in the

[sqlalchemy] Re: Issue when loading module in scheduler utility

2007-07-23 Thread svilen
On Monday 23 July 2007 16:45:15 Jesse James wrote: which python reference (url?) are you speaking of? how does 'import_fullname' work? how would it be applied? aaah, u are _that_ new... - use it instead of the __import__() func - original python library reference of the version u use; e.g.

[sqlalchemy] Re: Issue when loading module in scheduler utility

2007-07-23 Thread svilen
On Monday 23 July 2007 17:52:51 Jesse James wrote: aaah, u are _that_ new... - use it instead of the __import__() func - original python library reference of the version u use; e.g.http://docs.python.org/lib/built-in-funcs.html wow there's a level parameter now... somethin to try

[sqlalchemy] Re: Issue when loading module in scheduler utility

2007-07-23 Thread svilen
1: At least I'm in a working context...since I will be the user of this jobs module 90% of the time for a while, I'll have a fighting chance of refining it further to handle the other things you allude to. have fun then. As for the $100... give them to someone in _need_ (the mall is not in

[sqlalchemy] Re: Issue when loading module in scheduler utility

2007-07-23 Thread svilen
First, I appended the sys.path var like this (relative, was absolute before): sys.path.append( 'vor') IMO u should not touch sys.path unless u really really have no other chance. Although this above is another wholesale solution to your initial problem (and no need of my_imports

[sqlalchemy] Re: doing a one() on a unique key

2007-07-20 Thread svilen
i think there was .one() to return one and only one and die otherwise i.e. match {1}, and first() or similar that allows match {0,1}. On Friday 20 July 2007 18:42:56 Marco De Felice wrote: Hi all for my first post I'm using the new one() method like this:

[sqlalchemy] Re: dbcook 0.1

2007-07-19 Thread svilen
Isn't it what does already Elixir? not really. Frankly, i dont know much elixir, just some impressions. elixir is sort of syntax sugar over SA, with very little decision-making inside. It leaves all the decisions - the routine ones too - to the programmer. At least thats how i got it. This

[sqlalchemy] Re: lazy = None behavior help...

2007-07-17 Thread svilen
well, i'm using them NPs just to have another (simpler) select_table. otherwise anything query through primary_mapper starts off its own select_table, which can be rather huge in my case. if u can make the a query( primary_mapper, select_table) somehow possible... i won't need separate NPs.

[sqlalchemy] Re: lazy = None behavior help...

2007-07-17 Thread svilen
On Tuesday 17 July 2007 18:01:12 Michael Bayer wrote: if u can make the a query( primary_mapper, select_table) somehow possible... i won't need separate NPs. Note this selecttable is not additional .select() off the query, it IS the starting query(), e.g. thepolymorphic union in a big

[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 forgive

[sqlalchemy] Re: SQLAlchemy 0.3.9 Released

2007-07-16 Thread svilen
on the generative line: - how would i prepack a select (or some other filtering) and give it to a query() _later_? e.g. i have some table.c.type == 'person', and i want to apply to several queries? i can store the expression, doing query.select(expr) each time. Any other way? e.g. store a

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

2007-07-16 Thread svilen
On Monday 16 July 2007 17:08:08 Michael Bayer wrote: On Jul 16, 2007, at 2:59 AM, 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? this is

[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 the child

[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. Thanks

[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

[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: 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: 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 example

[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

[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 in a

[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 your

[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: 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: 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

[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 specifically

[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 table of

[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.

[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 object

[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` subclassing

[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

  1   2   >