[sqlalchemy] Deletion of referenced objects fails

2007-10-30 Thread Felix Schwarz
Hi, I have a problem using SQLAlchemy 0.4 when deleting referenced objects in a PostgreSQL database and adding new ones within the same transaction. Originally, I found the problem with Elixir 0.4.0-pre (svn r216) and SQLAlchemy 0.3.11 -

[sqlalchemy] unicode support for MSSQL

2007-10-30 Thread Florent Aide
Hi Mike, Hi all, Our conversation yesterday night on IRC gave me ideas :) I just added ticket #839 to the trac and attached a patch that enables unicode conversion for MSSQL dialects. I tested it with pyodbc but it should work the same with the other dialects. Best regards, Florent Aide.

[sqlalchemy] Re: Looking for feedback on encapsulating SA logic (newbie)

2007-10-30 Thread Lukasz Szybalski
Is this a turbogears app? or just your stand alone app? On 10/28/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I just started experimenting with .4 last night, and I'm really jazzed. The tutorials have been helpful, but I'm struggling to figure out how to bridge the gap between the

[sqlalchemy] Re: Separate version table

2007-10-30 Thread mmstud
Thanks Arnar, that was interesting to read. I learned a lot with these codes. Here i share current point of my progress. I managed to do mapper extension and document - documentversion objects seems to work ok, but im not so sure, if my solution was very elegant. So if anyone sees this and wants

[sqlalchemy] Re: Looking for feedback on encapsulating SA logic (newbie)

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 2:26 AM, Sanjay wrote: mapper(User, users_table) Is not using assign_mapper preferable? assign_mapper is an optional extension. its replaced in version 0.4 by the ScopedSession.mapper function, which is described in the docs. only use these extensions if you're

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Roger Demetrescu
Hei Wes and Paul... On 10/29/07, Wes Duff [EMAIL PROTECTED] wrote: Hey whats going on. I am a new sqlalchemist as well but lets see if this helps any. This is how I am getting a list of all names that corrispond with my document names class. names = [ c.name for c in

[sqlalchemy] sort results by date

2007-10-30 Thread Lukasz Szybalski
Hello, I am trying to make a select statement which involves date sorting. x1=model.User.select(model.User.c.ZIPCODE==zipcode ) now I get a list of 3 records x1[0],x1[1],x1[2] How can I sort x1 by x[0].c.DATE ?? ASC ? What would python code for that look like? or how could I change this to

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 10:16 AM, Roger Demetrescu wrote: If we need to introspect both Address-user and User-addresses, one solution is to not use the backref ... : use mapper.get_property(name) and mapper.iterate_properties(). I've considered removing properties as a public accessor

[sqlalchemy] Re: Impossible to reopen a ticket in TG's trac system

2007-10-30 Thread Roger Demetrescu
Dammit... Sent it to the wrong ML.. :-/ Sorry about the noise... Roger On 10/30/07, Roger Demetrescu [EMAIL PROTECTED] wrote: Hei guys... I have just tried to reopen a ticket, but I am getting this error: Submission rejected as potential spam (Akismet says content is spam) I

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Mike, use mapper.get_property(name) and mapper.iterate_properties(). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs: [Column('id', Integer(), primary_key=True, nullable=False)] [Column('val',

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Hi, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. Ok, I found a hacky way that does what I need: [(n, getattr(obj, n)) for n in dir(obj) if isinstance(getattr(obj, n),

[sqlalchemy] Re: Deletion of referenced objects fails

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 5:41 AM, Felix Schwarz wrote: foo = session.query(User).filter_by(name='Foo Bar').one() session.save(foo) for address in foo.addresses: foo.addresses.remove(address) session.delete(address) session.delete(foo) foo = User() session.save(foo) foo.id = 1

[sqlalchemy] Re: Looking for feedback on encapsulating SA logic (newbie)

2007-10-30 Thread [EMAIL PROTECTED]
Is this a turbogears app? or just your stand alone app? It's a standalone (and non-web) app. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Hi, Ok, I found a hacky way that does what I need: [(n, getattr(obj, n)) for n in dir(obj) if isinstance(getattr(obj, n), sqlalchemy.orm.attributes.InstrumentedAttribute)] Ooops, not quite what I need. How do I go from a CollectionAttributeImpl to a mapper? Paul

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread jason kirtland
Rick Morrison wrote: On 10/26/07, *Paul Johnston* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ticket #573 mentions adding a field for arbitrary application-specific information to tables. I now have a need for this, so I'm prepared to do the work to make it happen.

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 11:25 AM, Paul Johnston wrote: Mike, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs: [Column('id',

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Gaetan de Menten
On 10/30/07, Paul Johnston [EMAIL PROTECTED] wrote: Mike, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs:

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread Rick Morrison
personal opinion: I'm not wild about either 'attributes' or 'properties', (a) they seem too long, and (b) yes, they are too similar to generic ORM terms many many moons ago (pre Windows-1.0) I used an Ascii-GUI thing called C-scape (I think it's called vermont views now). anyway, most of its

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread jason kirtland
Rick Morrison wrote: personal opinion: I'm not wild about either 'attributes' or 'properties', (a) they seem too long, and (b) yes, they are too similar to generic ORM terms many many moons ago (pre Windows-1.0 ) I used an Ascii-GUI thing called C-scape (I think it's called vermont

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread Rick Morrison
The core can (and does) use these buckets too, so I'm not sure about the user-y moniker. Hold it. I thought the whole point of this was to separate core usage from user usage? To create a safe-zone for library user's private data. But if that were it, I'd only be +1 on a spelled out

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration (returning different object type based on db data)

2007-10-30 Thread Ron
you could just be using one mapper for all the classes here. its almost like you should monkeypatch class_mapper() and object_mapper() and just be done with it. of course the reason mappers are usually specific to a class is because, every class would have completely different attributes

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread jason kirtland
Rick Morrison wrote: The core can (and does) use these buckets too, so I'm not sure about the user-y moniker. Hold it. I thought the whole point of this was to separate core usage from user usage? To create a safe-zone for library user's private data. Yes to the second

[sqlalchemy] Re: Deletion of referenced objects fails

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 5:41 AM, Felix Schwarz wrote: for address in foo.addresses: foo.addresses.remove(address) session.delete(address) session.delete(foo) foo = User() session.save(foo) foo.id = 1 foo_addr = Address() session.save(foo_addr) foo_addr.street = Picadelly

[sqlalchemy] Re: Add arbitrary information to some classes

2007-10-30 Thread Rick Morrison
Ah sure, so it's to be a namespace for namespaces, a shared dict() parking lot. Got it. So then, how about aux etc other or maybe miscdata extra more additional supplemental auxiliary adjunct appendix surplus spare augment --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration (returning different object type based on db data)

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 1:35 PM, Ron wrote: I guess I should explain further what I'm trying to build. My app is a tool to help with managing clusters. This includes everything from Datacenters, Racks, Servers, Switches, etc. I don't know ahead of time the sorts of specific Things and

[sqlalchemy] Re: SQLalchemy coding style

2007-10-30 Thread McA
Hi all, thank you for your comments. I really expected to get comments from more people. But probably I'm concerned about something you don't have to. ;-) So, I'll wait. Best regards Andreas --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: SQLalchemy coding style

2007-10-30 Thread Lukasz Szybalski
On 10/30/07, McA [EMAIL PROTECTED] wrote: Hi all, thank you for your comments. I really expected to get comments from more people. But probably I'm concerned about something you don't have to. ;-) So, I'll wait. it seems better to use: import sqlalchemy and in code do:

[sqlalchemy] Re: SQLalchemy coding style

2007-10-30 Thread Rick Morrison
If you don't want to pollute the current namespace, then make an indirect reference. 1) Make a module of your own, say db.py 2) In db.py: ... from sqlalchemy import * from sqlalchemy.orm import * ... table1 = Table('footable', ...) ... # other