[sqlalchemy] Locking strategy

2010-09-30 Thread Warwick Prince
Hi All I would like some advice / best practice on the following basic problem please. I'm new to SQL so am groping with some things that used to be basic. :-( I've looked around in SA and have only found a few small notes on locking. There is a for_update but when I try this it appears to be

[sqlalchemy] Tutorial Issue

2010-09-30 Thread LucianU
Hello, all! I'm following the tutorial here http://www.sqlalchemy.org/docs/orm/tutorial.html and I'm running into some problems at one moment, specifically at the Configuring delete/delete-orphan Cascade section. Here is a paste of exactly what I'm doing http://bpaste.net/show/9861/ . Am I making

[sqlalchemy] Re: Uninitialized coltype in PGDialect.get_columns() for custom column basetype

2010-09-30 Thread Nikolaj
Sorry I was being a bit lazy and trying to avoid setting up the PG test environment. The problem affects a domain over a custom type. Here is a test that exhibits the behaviour (without assertions): class DomainOverCustomTypeReflectionTest(TestBase, AssertsExecutionResults): __only_on__ =

Re: [sqlalchemy] Re: Uninitialized coltype in PGDialect.get_columns() for custom column basetype

2010-09-30 Thread Michael Bayer
great, that test is perfect. I added ticket #1933, I just want to see if I can get the testtype to be available somehow before falling back to setting coltype=None solution. On Sep 30, 2010, at 9:22 AM, Nikolaj wrote: Sorry I was being a bit lazy and trying to avoid setting up the PG test

[sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread bogun . dmitriy
I try to update counter for omr object ang got following: Traceback (most recent call last): File /home/vugluskr/tmp/z/sa.py, line 56, in module main() File /home/vugluskr/tmp/z/sa.py, line 52, in main q2.update({data.cnt: data.cnt + 1}) File

Re: [sqlalchemy] Locking strategy

2010-09-30 Thread Michael Bayer
On Sep 30, 2010, at 4:43 AM, Warwick Prince wrote: Hi All I would like some advice / best practice on the following basic problem please. I'm new to SQL so am groping with some things that used to be basic. :-( I've looked around in SA and have only found a few small notes on

Re: [sqlalchemy] Tutorial Issue

2010-09-30 Thread Michael Bayer
OK, was hard to spot, and I think maybe I should change this, there's a line where it does this: users_table = User.__table__ So the original users_table is replaced with the one that User.__table__ is mapped to. I'm going to change that remapping to read like this: mapper(User,

Re: [sqlalchemy] Locking strategy

2010-09-30 Thread A.M.
On Sep 30, 2010, at 10:02 AM, Michael Bayer wrote: On Sep 30, 2010, at 4:43 AM, Warwick Prince wrote: Hi All I would like some advice / best practice on the following basic problem please. I'm new to SQL so am groping with some things that used to be basic. :-( I've looked

[sqlalchemy] ...kill_hung_threads status...

2010-09-30 Thread dobrysmak
Hi guys. I keep getting this message: [paste.httpserver.ThreadPool] kill_hung_threads status: 10 threads (1 working, 9 idle, 0 starting) ave time 0.03sec, max time 0.03sec, killed 0 workers Do I have to close a connection every time i'm querying the db? -- You received this message because

Re: [sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread Michael Bayer
this is a bug , created at http://www.sqlalchemy.org/trac/ticket/1935 , and a patch which fixes this issue is there. will try to get this committed soon. On Sep 30, 2010, at 9:57 AM, bogun.dmit...@gmail.com wrote: I try to update counter for omr object ang got following: Traceback

Re: [sqlalchemy] ...kill_hung_threads status...

2010-09-30 Thread Michael Bayer
On Sep 30, 2010, at 10:26 AM, dobrysmak wrote: Hi guys. I keep getting this message: [paste.httpserver.ThreadPool] kill_hung_threads status: 10 threads (1 working, 9 idle, 0 starting) ave time 0.03sec, max time 0.03sec, killed 0 workers Do I have to close a connection every time i'm

Re: [sqlalchemy] ...kill_hung_threads status...

2010-09-30 Thread Wichert Akkerman
On 9/30/10 16:26 , dobrysmak wrote: Hi guys. I keep getting this message: [paste.httpserver.ThreadPool] kill_hung_threads status: 10 threads (1 working, 9 idle, 0 starting) ave time 0.03sec, max time 0.03sec, killed 0 workers that's just the paste httpserver checking if any of your

[sqlalchemy] Problems with inserting data

2010-09-30 Thread phasma
Hi. I've got autoloadable table: --- class ObjectList(object): pass t_object_list = sa.Table('object_list', meta.metadata, autoload=True, autoload_with=engine) orm.mapper(ObjectList, t_object_list)

[sqlalchemy] how to make many-to-many links against the same class with an association table

2010-09-30 Thread Julien Iguchi-Cartigny
Hi, I've two classes CourseSet and CanonicalCourse (with the same parent) which need to be connected in a many-to-many relationship. But these classes are mapped on the same table, thus definition of the association table seems redondant: assoc_course_set_canonical_table = Table(

Re: [sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread bogun . dmitriy
2010/9/30 Michael Bayer mike...@zzzcomputing.com: this is a bug , created at http://www.sqlalchemy.org/trac/ticket/1935 , and a patch which fixes this issue is there.     will try to get this committed soon. Thanks, patch fix issue. I try to update counter for omr object ang got following:

[sqlalchemy] using funcs within a primary join

2010-09-30 Thread Dan
Hey, I am trying to create a funky relationship where I want to take a field in a table, take a portion of it and then use that portion to create a relation. Is this even possible? My relation is below reseller = relation(Reseller, uselist = False, primaryjoin =

Re: [sqlalchemy] Re: Problems with inserting data

2010-09-30 Thread Michael Bayer
dont send tuples as bind parameters for scalar attributes. one or more members of your data dictionary are tuples. On Sep 30, 2010, at 6:12 PM, phasma wrote: If add to sqlalchemy/orm/mapper.py at 1699 line this code: if isinstance(value, tuple):

[sqlalchemy] Re: Problems with inserting data

2010-09-30 Thread phasma
at: ol.type = data['type'], print type(data['type']) returns str print ol.__dict__ returns: {u'has_tire_shop': (False,), u'gps_lat': ('2',), '_sa_instance_state': sqlalchemy.orm.state.InstanceState object at 0x7fcc6002b0d0, u'name': ('2',), u'has_fitness': (False,), u'has_another': '',

Re: [sqlalchemy] how to make many-to-many links against the same class with an association table

2010-09-30 Thread Michael Bayer
you need to specify primaryjoin and secondary join when you do self ref using m2m. there's an example at the end of http://www.sqlalchemy.org/docs/orm/relationships.html#specifying-alternate-join-conditions-to-relationship , as well as some variants of that syntax which declarative

Re: [sqlalchemy] using funcs within a primary join

2010-09-30 Thread Michael Bayer
On Sep 30, 2010, at 4:47 PM, Dan wrote: Hey, I am trying to create a funky relationship where I want to take a field in a table, take a portion of it and then use that portion to create a relation. Is this even possible? My relation is below reseller = relation(Reseller, uselist

[sqlalchemy] Re: Problems with inserting data

2010-09-30 Thread phasma
I feel I need to sleep. Thank you :) On Oct 1, 2:47 am, Michael Bayer mike...@zzzcomputing.com wrote: you're doing this: data = {} data['type'] = 'some type' class Foo(object):     pass ol = Foo() ol.type = data['type'], print ol.type its a tuple, lose the ',' On Sep 30, 2010, at