[sqlalchemy] event.remove failure

2011-08-18 Thread sandro dentella
Hi, I started to play with events to port a library to sqla 0.7. I managed to use the 'listen' function but I failed on 'remove'. Looking at the signatures they seem to be just the same, but here is what I get: In [7]: event.listen(obj.__class__.title, 'set', listen_cb) In [8]:

[sqlalchemy] Re: event.remove failure

2011-08-18 Thread sandro dentella
On 18 Ago, 16:52, Michael Bayer mike...@zzzcomputing.com wrote: remove() isn't implemented yet.    While the simple operation you see below would be fine for a single listener on a single target, the targets we have which propagate to subclasses (mapper events, attribute events) would

[sqlalchemy] Re: association_proxy introspection

2011-03-23 Thread sandro dentella
On Tue, Mar 22, 2011 at 05:43:17AM -0700, sandro dentella wrote: Hi, i just discovered association_proxy and like it very much. It definetely helps in some situations. I already have a library that setup gui instrospecting the mapper, to allow editing and filtering of records. the only

[sqlalchemy] association_proxy introspection

2011-03-22 Thread sandro dentella
Hi, i just discovered association_proxy and like it very much. It definetely helps in some situations. I already have a library that setup gui instrospecting the mapper, to allow editing and filtering of records. the only way I found to get the association_proxy of a class is checking its

[sqlalchemy] attaching an AttributeExt to an existing mapper

2011-02-07 Thread sandro dentella
Hi, is there a way to attach an attribute extension of an existing property of an (existing) mapper? I made some tests [1] and it seems that attaching the AttrExt to a mapper does not work: mapper.get_property('name').extension = MyAttrExt() Is there a way apart from setting it while

[sqlalchemy] Re: mapper for outerjoin: getting None objects

2010-10-31 Thread sandro dentella
Thanks as usual for your valuable and prompt response sandro *:-) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] LONGVARCHAR

2010-10-29 Thread sandro dentella
Hi, firefox uses sqlite to store bookmark info. The file is called places.sqlite and the schema has type LONGVARCHAR for some fields and LONG for another. Autoloading that with sqlalchemy maps that columns to NullType rather that to a String / Integer one. Same for LONG type I don't really know

[sqlalchemy] Re: CircularDependencyError on 0.6 (works on 0.5.8)

2010-09-02 Thread sandro dentella
On 26 Ago, 18:41, Michael Bayer mike...@zzzcomputing.com wrote: of course you'll get a cycle if you do this, though: s1 = School(cod=S1, cod_riferimento=S1, cliente=False) d1 = School(cod=D1, cod_riferimento=S1, cliente=False) s1.sedi = [s1, d1] That was it! now I got it. thanks. s1-s1

[sqlalchemy] upgrading code with prop.backref from 0.5 - 0.6

2010-08-19 Thread sandro dentella
Hi, Let's start with the simple example based on movie/director example class Director(Base): __tablename__ = 'director' id = Column(Integer, primary_key=True) last_name = Column(String(60), nullable=False) movies = relation('Movie',

[sqlalchemy] Re: mappers and non_primary arg

2010-07-05 Thread sandro dentella
Please, can anybody tell me what's the meaning of 'non_primary' arg of mapper function. I probably misunderstood it but I'd like to know what it is meant for. thanks sandro On Thu, Jul 01, 2010 at 10:41:44AM -0700, sandro dentella wrote: Hi, I'm trying to use non_primary arg of function

[sqlalchemy] mappers and non_primary arg

2010-07-01 Thread sandro dentella
Hi, I'm trying to use non_primary arg of function 'mapper'. Currently I have a GUI widget to browse/edit tables that is based on introspection of the mapper. My goal would be to reuse all the machinary of table browsing even when browsing tables tat where built w/o primary key. I'm ready to

[sqlalchemy] Re: declarative + order_by of 2 columns: is it possible?

2010-05-18 Thread sandro dentella
Hi, On 11 Mag, 18:23, sandro dentella san...@e-den.it wrote: Hi, i have a working declarative configuration that has a relation as this:: client = relation(Cliente, backref='jobs' , lazy=False, order_by=status.desc) now I'd like to add a second column in the order_by field but adding

[sqlalchemy] declarative + order_by of 2 columns: is it possible?

2010-05-11 Thread sandro dentella
Hi, i have a working declarative configuration that has a relation as this:: client = relation(Cliente, backref='jobs' , lazy=False, order_by=status.desc) now I'd like to add a second column in the order_by field but adding a list doesn't seem to work. I tried: client = relation(Cliente,

[sqlalchemy] Re: Type of Column added with column_property

2009-12-16 Thread sandro dentella
': column_property( func.my_bool(t.c.id, type=Boolean) ) }) func 'my_bool' is a stored procedure on Postgresql and returns a boolean, but the type of the column is NullType: m.get_property('my_bool').columns[0].type NullType() -- Sandro

[sqlalchemy] Doubts on relation with cascade delete by backend

2009-07-23 Thread sandro dentella
Hi, I have a simple setup that may be summarized as: class User(Base): __tablename__ = 'user' name = Column(String(20), primary_key=True) class Mail(Base): __tablename__ = 'address' mail = Column(String(20), primary_key=True) user_name =

[sqlalchemy] compound ForeignKeyConstraint

2009-07-17 Thread sandro dentella
Hi, which is the correct way to see if a ForeignKey in the set column.foreign_key is part of a compound ForeignKeyConstraint? thanks in advance sandro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: creating objects in after_flush hook

2009-05-12 Thread sandro dentella
I correct myself On 12 Mag, 11:05, Alessandro Dentella san...@e-den.it wrote: Hi, in a sessionExtension.after_flush hook I create objects (namely todo actions depending on what people have inserted/updated). At present I create these objects in the current session, but I do

[sqlalchemy] Re: puzzling outerjoin in the mapper

2009-04-30 Thread sandro dentella
Thanks. I do appreciate that this will become the default as I think that if you ask for an outer join that's what you expect. thanks again for you time sandro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: puzzling outerjoin in the mapper

2009-04-27 Thread sandro dentella
Missing an answer I opened ticket #1392: http://www.sqlalchemy.org/trac/ticket/1392#preview --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: puzzling outerjoin in the mapper

2009-04-23 Thread sandro dentella
Hi, Mike, should I file a ticket for this?... or I just misinterpreted the result? sandro *:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: Attempting to flush an item of type...

2009-04-17 Thread sandro dentella
the solution was to inherit setup.USER with a non-relative path fossati.models.client.User. I misinterpreted the words 'whose mapper...' and believed it was referencing Entry.user while it is referred to setup.USER. sandro --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: availability of related obj

2009-04-08 Thread sandro dentella
as soon as Ticket is persistent within the flush, the ticket.assigned_to relation will be live and will lazy load when accessed. no commit is needed. mmh, in the following example, I can't use assigned_to within after_flush. Am I doing something wrong? from sqlalchemy.ext.declarative import

[sqlalchemy] Re: availability of related obj

2009-04-08 Thread sandro dentella
specifically the lazy loader will work in the after_flush_postexec() phase of the sessionextension. during after_flush(), the post-flush bookkeeping has not been establishsed yet on assigned_to_id, and the lazy loader always looks for the persisted version of the attribute. ok, this

[sqlalchemy] Re: remove an object from a property deletes from session

2009-03-27 Thread sandro dentella
On 26 Mar, 18:04, Michael Bayer mike...@zzzcomputing.com wrote: it would only do that if you have delete-orphan on the relation, and the object was never saved.it will get re-added once you attach it to that's exactly the situation I have. thanks for the explanation. sandro *:-)

[sqlalchemy] Re: getting referenced *class* from relation

2009-03-17 Thread sandro dentella
thanks! *:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to

[sqlalchemy] Re: puzzling setup with ForeignKey

2009-02-19 Thread sandro dentella
On 19 Feb, 13:15, a...@svilendobrev.com wrote: if u make it the same way as the other ticket_status... key, would it work? No, it won't. *:-( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] Autoloading float field from sqlite

2009-01-07 Thread sandro dentella
I realize now that autoloading a float field in Sqlite returns a SLNumeric rather that Float. The schema is: sqlite .schema all_types CREATE TABLE all_types ( ... float FLOAT, ... PRIMARY KEY (id) ); is this a known issue? sandro *:-)

[sqlalchemy] query doctest

2008-11-29 Thread sandro dentella
Hi, in a doctest I have:: str(q) == str(query.filter(User.first_name == 'ed')) True that works but the following fails, (both where built starting from the same session.query(User) q == query.filter(User.first_name == 'ed') True in another place comparing str fails just because a join

[sqlalchemy] flush session.is_modified()

2008-11-18 Thread sandro dentella
Hi, I have a code like this: if self.session.dirty: for dirty in self.session.dirty: if self.session.is_modified(dirty): return True if self.session.new: for obj in self.session.new: if self.session.is_modified(obj): return True I realized that

[sqlalchemy] Printing SQL statement

2008-11-13 Thread sandro dentella
I noticed in message [1] a way of getting sql statement of meta.create_all(). It doesn't work for me: File /tmp/sa.py, line 11, in module gen = e.dialect.schemagenerator(e, proxy, None) File /misc/src/hg/py/sqlkit4/bin/../sqlalchemy/sql/compiler.py, line 777, in __init__ AttributeError:

[sqlalchemy] [Announce] sqlkit 0.8.3

2008-11-11 Thread sandro dentella
I hope this list may be interested in this package based on sqlalchemy. Working with sqlalchemy has been a very nice experience, any day discovering some nice feature of sqlalchemy that just fitted my needs. I know I only used a subset of SA power but my intention is to add features as long as I

[sqlalchemy] Missing 'match' documentation?

2008-10-20 Thread sandro dentella
Hi, I think I don't see documentation on the 'match' operator that works differently according to db backend. If I just missed it please point me to the right place, otherwise can you give me some more info? How can it be used with sqlite: can it work as ~ in postgres? If I try lo used

[sqlalchemy] ClauseList with join?

2008-10-11 Thread sandro dentella
Hi, I started using the .join() method on query and that' s really powerful, with reset_joinpoint and the list of attributes setting the path of relations. Now I'd like to being able to write join clause in advance with respect to the moment I have the the query available , in he same way I

[sqlalchemy] Re: commit vs flush

2008-09-08 Thread sandro dentella
least this seems to me...) In the GUI I use as test, thoght objects are flushed but they come back unless I issue a session.commit(). Hmm. If by come back you mean they show back up in a separate session and still exist in the database, then it may be that you've forgotten to commit

[sqlalchemy] commit vs flush

2008-09-07 Thread sandro dentella
Hi, I'm trying to flush deletion of single objects w/o triggering a complete commit and even after reading the docs several time I think I have not got it right. In a little test I manage to do it correctly: I delete/ flush single objects and they are DELETEd from the table (at least

[sqlalchemy] Re: session.dirty but not session.is_modified....

2008-07-16 Thread sandro dentella
Thanks. In fact I use session.is_modified() but I thought it was just a workaround to cope with something I didnt' thoroughly understand... sandro *:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: validation and old values

2008-06-29 Thread sandro dentella
thanks sandro *:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED]

[sqlalchemy] session expire and discard

2008-06-29 Thread sandro dentella
Hi, is there a way to say to a session to forget all the changes to an object without hitting the database. Expire or refresh do that but at the prize of a new select. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] validation and old values

2008-06-25 Thread sandro dentella
Hi, I'm adding validation to a (generic) gtk sql editor. The first thing I'd like to know is if I can reach the old values of an instance after I modified it (before committing). The reason is that I'd like to give the possibility to have new and old values in the validation of

[sqlalchemy] PG: INET type support

2006-10-30 Thread Sandro Dentella
to know the type of a returned data after autoloading a Table but *before* issueing a query? (to know wich widget should handle it). TIA sandro *:-) -- Sandro Dentella *:-) http://www.tksql.orgTkSQL Home page - My GPL work