[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Marco Mariani
Stefano Bartaletti wrote: I need to gather IDs in after_commit because theID is a serial Postgres value that is available only after flush() Not really... in postgres, you can ask to consume the next sequence value with SELECT NEXTVAL('sequence_name') and explicitly set that as primary

[sqlalchemy] Re: column_property() caching

2007-12-04 Thread Marco Mariani
Vladimir Iliev wrote: hi, is it possible to add a non-caching column_property() to my mapping? You can use expire() on a single column, so you could proxy that column with a @property that also expires it. -- This e-mail (and any attachment(s)) is strictly confidential and for use only

[sqlalchemy] Re: features: database drivers and ssl

2007-11-15 Thread Marco Mariani
Rick Morrison wrote: Hi Marco, [...] Thank you. Very helpful. --~--~-~--~~~---~--~~ 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

[sqlalchemy] features: database drivers and ssl

2007-11-14 Thread Marco Mariani
I need to evaluate a third-party application, that will be integrated with others by one of my programs. My integration app runs on linux with SA 0.4, and I will strive to use the latest stable release. I need to write a couple of requirements to choose the third-party application. Will I

[sqlalchemy] Re: mapper

2007-11-06 Thread Marco Mariani
lur ibargutxi wrote: 'idindicatorgroupcontainer' : relation(IndicatorGroups, primaryjoin=sql.and_(IndicatorGroups.idindicatorgroup==GroupGroups.idindicatorgroupcontainer)),'idindicatorgroupcontained' : relation(IndicatorGroups,

[sqlalchemy] Re: mapper

2007-11-06 Thread Marco Mariani
lur ibargutxi wrote: I forgot. Try using tables instead of classes that are not mapped yet.. mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'], properties = { 'idindicatorgroupcontainer' : relation(IndicatorGroups,

[sqlalchemy] Re: turbogears, sqlalchemy and utf8

2007-10-23 Thread Marco Mariani
Lukasz Szybalski wrote: dev.cfg has sqlalchemy.dburi=mysql://user:[EMAIL PROTECTED]:3306/dbname sqlalchemy.convert_unicode = True --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Re: TurboGears: best practices for SELECTing

2007-10-11 Thread Marco Mariani
James Brady ha scritto: Hi Marco, assign_mapper did help - the relations are now accessible through my models, and the query syntax is nicer than pure SA as well in my opinion. However, I'm using the identity framework (part of TurboGears) Me too. which unfortunately doesn't play nicely

[sqlalchemy] Re: TurboGears: best practices for SELECTing

2007-10-10 Thread Marco Mariani
James Brady ha scritto: The problem I'm hitting at the moment is how to properly select simple objects... There seems to be two main approaches, for example: session.query(Ownership).select() or ownership_table.select().execute() With the first approach, I get InvalidRequestError: Parent

[sqlalchemy] Re: insert() on compound key-how to auto number second key

2007-09-08 Thread Marco Mariani
Lukasz Szybalski ha scritto: I am trying to insert a record with a compound primary key that consists of Team_Sid, User_Sid I can either do i = users_table.insert() i.execute(TEAM_SID=343, USER_SID=1,TEAM_NAME='the team') i.execute(TEAM_SID=343, USER_SID=2,TEAM_NAME='the team')

[sqlalchemy] Re: creating a database through SQLAlchemy

2007-09-03 Thread Marco Mariani
Travis Kriplean ha scritto: However, this seems a bit ugly. Is there a way to obtain a non- transactional connection from an engine in 0.3.10? If not, is it possible in 0.4? I use this with SA 0.3.10 and Postgres:

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-20 Thread Marco Mariani
Lukasz Szybalski ha scritto: Got another error here. but I guess its fixed in a newer version of sqlalchemy via ticket 482 Yes. I wasn't aware of 482 because I usually try to avoid table names that _must_ be escaped (mixed caps, reserved words, etc). put assign_mapper() in place of

[sqlalchemy] Re: strange serial problem in postgres

2007-08-17 Thread Marco Mariani
Glauco ha scritto: Thank you kevin , i've worked a lot over PG and this tecnique is consolidated in our model.. but here the problem is that the column is a simplycolumn_name INTEGER NOT NULL references other_table(id) and i cannot understand why sqlalchemy whant to use it as a

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-17 Thread Marco Mariani
Lukasz Szybalski ha scritto: bind_meta_data() users_table = Table('users', metadata, autoload=True) class Users(object): pass usersmapper=mapper(Users,users_table) assign_mapper() in place of mapper() mysession=session.query(Users) 1. What would be the code from now on to

[sqlalchemy] Re: Hierachical data

2007-08-03 Thread Marco Mariani
Alexandre CONRAD ha scritto: Maybe this should need some attention to implement in SA some API to handle nodes (insert, move, remove) of herachical trees in SA the Nested Set way. There are several ways to implement schema and rules (and therefore APIs) just by looking at Celko's

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-31 Thread Marco Mariani
Michael Bayer ha scritto: can i have an example http://trac.turbogears.org/browser/branches/1.0/turbogears/database.py?rev=2320 281 [run_with_transaction.when(_use_sa())] 282 def sa_rwt(func, *args, **kw): 283 log.debug(New SA transaction) 284 transaction =

[sqlalchemy] Re: a renaming proposal

2007-07-27 Thread Marco Mariani
svilen ha scritto: Anyway it may depend which audience are u targeting with these names - those who never seen an API or those for which names are important only to associate them with a library/version/use-case... both extremes are equaly uninteresting imo. I think targeting those

[sqlalchemy] Re: autoload'ing metadata

2007-07-26 Thread Marco Mariani
[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_Tree_Comparison_Approach_to_Detect.pdf The complete title of the paper is A Tree Comparison Approach To

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-25 Thread Marco Mariani
Anton V. Belyaev ha scritto: again, im not opposed to this feature and ill patch in an adequate (and fully unit-tested) implementation. but have you actually ever *had* this problem? or is it just hypothetical ? For example, a developer modifies the metadata and checks in. Another

[sqlalchemy] Re: Query.get with unordered multiple-column-primary-key

2007-06-13 Thread Marco Mariani
Roger Demetrescu ha scritto: query.get(dict(columnB='foo', columnA='bar') Lazy programmers are the best ones... :) That's the reason lazy programmers share a superclass for all their domain objects... hint, hint :-) --~--~-~--~~~---~--~~ You received

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

2007-06-06 Thread Marco Mariani
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 .order_by()? e.g. i want: q1 = query.filter(

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

2007-06-06 Thread Marco Mariani
svilen ha scritto: because q1 with the order is _the_ query, made at point A somewhen, and stored there as a construct; much later at some point B i need to use that query but without the ordering - now i have to keep 2 copies of the query, w/ and w/out order. And this strip-the-ordering

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-06 Thread Marco Mariani
Sanjay ha scritto: BTW, the session transaction is stored in cherrypy.request.sa_transaction. Yes, but it's been added recently. Does this help simplify the statements? Transaction instances have a connection() property. So, cherrypy.request.sa_transaction.connection should work.

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-05 Thread Marco Mariani
Sanjay ha scritto: Need help on how to do it. Being a turbogears application where db entities like metadata and session are imported rather than created by me, I am confused and could not successfully implement the pattern provided in the docs. I'm sure there are cleaner ways, but this

[sqlalchemy] Re: winpdb and sqlalchemy

2007-05-16 Thread Marco Mariani
Edin Salkovic ha scritto: Currently, SQLAlchemy's setup(...) hasn't set this arg, meaning that setuptools uses its own algorithm to determine if SQLAlchemy can be installed as a zipped egg. You can switch off zip for all newly installed eggs, in ~/.pydistutils.cfg [easy_install] zip_ok

[sqlalchemy] Re: query().filter_by(boolean)

2007-04-13 Thread Marco Mariani
Michael Bayer wrote: please file a ticket for this. done, #535 --~--~-~--~~~---~--~~ 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

[sqlalchemy] query().filter_by(boolean)

2007-04-12 Thread Marco Mariani
I'm not trying the trunk, and it's the first time I use filter_by, but I guess: MappedClass.query().filter_by( MappedClass.column_name == 'Foo' ) equates to filter_by(False), because the .c is missing and it's comparing an UOWProperty to a string, instead of a Column object to a string

[sqlalchemy] parameter binding in connection.execute()

2007-04-03 Thread Marco Mariani
I know I can have bound parameters in engine.text(): t = engine.text(select foo from mytable where lala=:hoho) r = t.execute(hoho=7) ...but I need the same for connection.execute(), since I am using temporary tables and they are not accessible via engine.text Should I resort to manual

[sqlalchemy] Re: Dealing with uncommited data

2007-03-20 Thread Marco Mariani
Andreas Jung wrote: In a traditional application you can insert a new row and read the row within the same transaction. What is the typical usage pattern to deal with this in SA? In our particular setup (Zope) a new session is created for each new HTTP request and flushed automatically at

[sqlalchemy] Re: Help get Wikipedia entry through review

2007-02-15 Thread Marco Mariani
Paul Johnston wrote: Hi, Well, more than improving the quality of the article, we need to make a case for it being notable. The main criteria for this is: Software is notable if it has been the subject of multiple non-trivial published works whose source is independent of the software's

[sqlalchemy] Re: Object-oriented engine?

2007-02-09 Thread Marco Mariani
svilen wrote: how much OO u want? He's not using a DBMS. He has more OO-ness than SA could give him :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] just how lazy are backrefs?

2007-02-06 Thread Marco Mariani
I'm working inside TurboGears, autoload everything. Tested with 0.3.3 and Trunk. I find this strange behaviour: when I declare a relation between a Person and a Contract: assign_mapper(context, Contract, tbl['contracts'], properties = { 'responsible' : relation(Person,

[sqlalchemy] Re: just how lazy are backrefs?

2007-02-06 Thread Marco Mariani
Marco Mariani wrote: john.contracts_responsible gives me AttributeError: 'Person' object has no attribute 'contracts_responsabile' this is a cut-n-translate-n-paste typo, should read contracts_responsible of course --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: count(*) function

2007-01-15 Thread Marco Mariani
milena wrote: I have tried select([func.count(*)], from_obj=[table_name]).execute() but it didn't work I suppore you're not using mappers, so this is the fastest method: number_of_rows = table.count().execute().fetchone()[0] where table is the table object

[sqlalchemy] Re: Column aliases

2007-01-15 Thread Marco Mariani
Michael Bayer wrote: to have aliases of properties that are usable with get_by(), use the synonym function, described in: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_overriding Thank you. Altough the docs are very well done, there are many APIs and that

[sqlalchemy] Column aliases

2007-01-12 Thread Marco Mariani
Hi there This relates to Turbogears, but is really a SA question. I've customized TG authentication authorization to use my autloaded tables in Postgres and SqlAlchemy 0.3.3. In my schema, I have User.c.uid, the login name of the users, as a primary key TG uses a User mapper with two

[sqlalchemy] Re: unicode

2006-12-14 Thread Marco Mariani
Lee McFadden wrote: Going from the line number in your exception that would be because your columns are of type String. Change the columns to Unicode and it should solve your problem. foo_table = Table('foo', metadata, Column('id', Integer, primary_key=True), Column('bar',

[sqlalchemy] autoload, composite foreign keys

2006-12-01 Thread Marco Mariani
Does sqlalchemy have some limit in handling composite primary keys with autoload? I've tried postgres 8.1 and SA 0.3 or trunk. I have a 'tree' of four tables, and SA does not create the full join to follow composite foreign keys. The schema and test model is in the attachment. As I've seen,