[sqlalchemy] alternate ways to removing event listeners?

2016-09-26 Thread Iain Duncan
Hi folks, I'm having an issue with event listener registration. I figured out that I need to deregister my listeners after each functional test so they don't get registered twice in the same thread and execute too many times. But I was using an anonymous callable to register them, like this:

Re: [sqlalchemy] Joining, if join not already done?

2016-09-09 Thread Iain Duncan
ok thanks. +1 for adding that in the long term! iain On Fri, Sep 9, 2016 at 2:17 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > On 09/09/2016 05:13 PM, Iain Duncan wrote: > >> Hi all, I have a query that gets conditionally extending depending on >> wha

[sqlalchemy] Joining, if join not already done?

2016-09-09 Thread Iain Duncan
Hi all, I have a query that gets conditionally extending depending on what's going with a given request. I've got a section where it should join something and search on that join, but if the same join has already happened, I get an error. I've figured out i can do the following, which looks like

Re: [sqlalchemy] postgres/pyscopg failing to connect after a certain number of tests, stuck!

2016-09-08 Thread Iain Duncan
Thanks Mike! engine.dispose() fixed it. Makes sense that it was a garbage collection problem. For any others finding this, I just added a call to engine.dispose() to class level tearDown and it's all good. On Thu, Sep 8, 2016 at 10:39 AM, Iain Duncan <iainduncanli...@gmail.com> wrote:

Re: [sqlalchemy] postgres/pyscopg failing to connect after a certain number of tests, stuck!

2016-09-08 Thread Iain Duncan
t; Engine per test is v inefficient, are you at least calling dispose() on >> each one in teardown? >> >> >> On Thursday, September 8, 2016, Iain Duncan <iainduncanli...@gmail.com> >> wrote: >> >>> Hi Jonathan, sure can, here it is below. I think maybe thi

Re: [sqlalchemy] postgres/pyscopg failing to connect after a certain number of tests, stuck!

2016-09-08 Thread Iain Duncan
newb. Should I be adding dispose in class level teardown? thanks! Iain On Thu, Sep 8, 2016 at 10:26 AM, Mike Bayer <mike...@zzzcomputing.com> wrote: > Engine per test is v inefficient, are you at least calling dispose() on > each one in teardown? > > > On Thursday, Se

Re: [sqlalchemy] Re: postgres/pyscopg failing to connect after a certain number of tests, stuck!

2016-09-08 Thread Iain Duncan
Hi Jonathan, sure can, here it is below. I think maybe this has something to do with the fact that we are creating a new engine and dropping the schema on each pass maybe? Because it seems to *only* happen when we run about 75 tests in a row. Thanks for looking! class

[sqlalchemy] postgres/pyscopg failing to connect after a certain number of tests, stuck!

2016-09-07 Thread Iain Duncan
Hi folks, I'm not sure if this is the right place to ask really. I have some functional tests, using webtest, in which I make an engine and make a couple of session that get used in addition to the webtest app. I close the sessions in the tearDown method after each test. Now that the number of

[sqlalchemy] experience with marshmallow-sqlachemy?

2016-06-07 Thread Iain Duncan
Hey y'all, just want to know if anyone has used and would like to share experiences/opinions re marshmallow and marshmallow-sqalchemy. thanks! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving

[sqlalchemy] Re: strategies/tools for conversion from json dicts to SQLAlchemy objects in large apps?

2016-06-07 Thread Iain Duncan
I should add that I'm not married to Colander either, if people have had good experiences with Marshmallow-Sqlalchemy, I could very well switch to that. thanks! On Tue, Jun 7, 2016 at 9:17 AM, Iain Duncan <iainduncanli...@gmail.com> wrote: > Hi folks, I'm working on an internal framew

[sqlalchemy] strategies/tools for conversion from json dicts to SQLAlchemy objects in large apps?

2016-06-07 Thread Iain Duncan
Hi folks, I'm working on an internal framework using Pyramid, Colander, and SQLAlchemy, and it's for much more enterprisey apps than I have previously done. We're looking at having a full fledged service layer, and using the ZCA as a DI framework a fair bit. I'm hoping folks can share their

[sqlalchemy] natural vs surrogate keys for user groups?

2015-07-23 Thread Iain Duncan
Hi folks, I'm starting a green field project and one component is a stand alone auth micro service. It will have one job only, log people in and set their group list. After that, the group list and user id will be going in jwt tokens and will be used in subsequent apps as fields for the remote

[sqlalchemy] best books on DB design for sqlalchemy users?

2015-07-23 Thread Iain Duncan
I feel like I should really take up my db game for an upcoming set of projects, and am wondering if there are any real standout books on db design that fit well with the design philosophy of SQLA. Recos much appreciated! thanks Iain -- You received this message because you are subscribed to the

[sqlalchemy] Mysql issue with big composite primary keys

2014-11-09 Thread Iain Duncan
Hi folks, I've been googling and cargo culting to no avail here, hope someone can help. I'm trying to get an app running on MySQL on OS X, that was running fine on MySQL on Linux. The issue is I have some large composite primarky keys: class VarTrigger(Base): assoc table that associates

Re: [sqlalchemy] queue pooling, mysql sleeping, for very occasional use apps?

2014-09-21 Thread Iain Duncan
, 2014, at 8:43 PM, Iain Duncan iainduncanli...@gmail.com wrote: So can anyone tell me what exactly happens with NullPool, I'm not clear from the docs. Does that mean a fresh connection will be made on a new hit, and we'll never get the gone away, but at the expense of slower connections

[sqlalchemy] queue pooling, mysql sleeping, for very occasional use apps?

2014-09-19 Thread Iain Duncan
Hi folks, I'm putting together something for a client that will get used very occasionally, and has a some worker processes that use SQLA. I'm wondering what the right approach is for the dreaded MySQL has gone away. Should I just use some absurdly high number for pool_recycle ( ie months) or is

Re: [sqlalchemy] Re: queue pooling, mysql sleeping, for very occasional use apps?

2014-09-19 Thread Iain Duncan
Thanks guys! Iain On Fri, Sep 19, 2014 at 12:41 PM, Jonathan Vanasco jvana...@gmail.com wrote: Just to add to jeff's response, I had a similar situation with Postgres under a twisted app a while back. Someone else on the twisted list was using Mysql + Twisted + Sqlalchemy and pointed to

Re: [sqlalchemy] Re: queue pooling, mysql sleeping, for very occasional use apps?

2014-09-19 Thread Iain Duncan
, Iain Duncan iainduncanli...@gmail.com wrote: Thanks guys! Iain On Fri, Sep 19, 2014 at 12:41 PM, Jonathan Vanasco jvana...@gmail.com wrote: Just to add to jeff's response, I had a similar situation with Postgres under a twisted app a while back. Someone else on the twisted list was using

[sqlalchemy] Re: using SQLAlchemy on mobile devices?

2014-04-28 Thread Iain Duncan
For future browsers, apparently it can be done with Kivy, but I haven't tried it. Kivy looks very promising as a way to use Python on iOs and Android though! iain On Sun, Apr 27, 2014 at 10:30 AM, Iain Duncan iainduncanli...@gmail.comwrote: Sorry if this is a stupid question, but does anyone

[sqlalchemy] using SQLAlchemy on mobile devices?

2014-04-27 Thread Iain Duncan
Sorry if this is a stupid question, but does anyone here know if any of the various Python-to-native-mobile platforms allow one to use sqlalchemy with sqlite for persistence? (Kivy? Pythonista? Whatever else is out there?) I'm wondering whether it's possible (yet?) to write an app that: - runs

[sqlalchemy] Sorting on joined columns with a mapper?

2014-02-08 Thread Iain Duncan
Hi folks, I have a mapper that has an order by clause, and I was hoping to get it to work with secondary sorts on the joined tables, wondering if this is possible, or if not, how I could add some other kind of more complex sorting? Here's what I hoped would work but didn't:

Re: [sqlalchemy] table inheritance: how to change a record from base type to derived type?

2013-12-11 Thread Iain Duncan
On Tue, Dec 10, 2013 at 3:54 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 10, 2013, at 5:04 PM, Iain Duncan iainduncanli...@gmail.com wrote: Hi, I'm stuck on how to do something that I'm sure must be possible. I have two kinds of records, using table inheritance, Client

[sqlalchemy] table inheritance: how to change a record from base type to derived type?

2013-12-10 Thread Iain Duncan
Hi, I'm stuck on how to do something that I'm sure must be possible. I have two kinds of records, using table inheritance, Client, and SpecialClient. SpecialClient has extra fields and it's own polymorphic identity. I need to *promote* a and existing client record to a special client. I tried

Re: [sqlalchemy] Re: most established SQLA fixture tools?

2013-10-17 Thread Iain Duncan
Thanks Jonathan, Alembic has been on my to-check-out list for a while. Does anyone here use it for test db population? I'm honestly not seeing the big advantage of populating from json files, but I suppose there must be some. At any rate I have them from a previous project the same client has

[sqlalchemy] locking tables with orm? need to generate PK manually...

2013-10-16 Thread Iain Duncan
Hi folks, I'm working on a legacy database that has some issues with PK generation. The long and short of it is that for now, I need to generate an PK by locking a table, because that's what they've been doing. I'm using the orm, and basically want to be able to use a session briefly with the

Re: [sqlalchemy] locking tables with orm? need to generate PK manually...

2013-10-16 Thread Iain Duncan
Thanks Micheal, that's what I hoped! iain On Wed, Oct 16, 2013 at 12:13 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Oct 16, 2013, at 1:38 PM, Iain Duncan iainduncanli...@gmail.com wrote: Hi folks, I'm working on a legacy database that has some issues with PK generation. The long

[sqlalchemy] most established SQLA fixture tools?

2013-10-16 Thread Iain Duncan
Hi folks, I'm trying to stick to the most established packages for doing a lot of stuff I'm used to doing with my own tools years and years ago, in order to keep the new job happy. What are most people using with SQLAlchemy for populating test databases? They are used to Django, so if there's

[sqlalchemy] sqlalchmey 0.8 stuck on a join with reflected tables

2013-10-12 Thread Iain Duncan
Hey folks, hit a new error message and the googling is not turning up much, and as I'm new to postgres, I'm frankly over my head. I have a wack of reflected tables and I'm trying to get a join working. The one I'm ultimately after has a composite primary key of 2 different foreign keys and an int

Re: [sqlalchemy] Session creation without scoped session?

2013-10-11 Thread Iain Duncan
Thanks Michael, that's very helpful. Iain On Fri, Oct 11, 2013 at 7:18 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Oct 10, 2013, at 8:57 PM, Iain Duncan iainduncanli...@gmail.com wrote: Seems like there are some variety of opinion on some stuff on the pyramid list so I thought

Re: [sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-05 Thread Iain Duncan
Thanks guys. Jonathan, that is, I think, what will be going on. So, I'm not quite clear from your comments, using SQLAlchemy with Twisted is practical now or not? Is it better to do it with Twisted than with Gevent? If you have the time to explain further about the persisting the session comment

[sqlalchemy] using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-03 Thread Iain Duncan
Hi folks, I just got a new position and am hoping I can advocate for using SQLAlchemy there. I will be doing some backend web service stuff that interacts with a db, but likely in some form of distributed architecture. It's all going to be on AWS. I believe there will be some service

Re: [sqlalchemy] finding sqlalchemy jobs?

2013-09-27 Thread Iain Duncan
Thanks Michael, much appreciated! Iain On Fri, Sep 27, 2013 at 7:43 AM, Michael Bayer mike...@zzzcomputing.comwrote: I'll keep my ears open.Where I work we've taken on remote contractors in the past but at the moment it's pretty tight. On Sep 25, 2013, at 6:49 PM, Iain Duncan

[sqlalchemy] finding sqlalchemy jobs?

2013-09-25 Thread Iain Duncan
Hi folks, apologies for sounding spammy. I'm wondering if anyone has suggestions on how to find remote work doing SQLAlchemy stuff, been wanting to leave the uncertain world of freelancing and do some actual coding for a while. I found some posts tagging SQLAlchemy on Stack Overflow Careers, but

[sqlalchemy] wake of RoR sql injection vulnerability

2013-01-09 Thread Iain Duncan
Just curious as to whether anyone has seen changes in interest in SQLAlchemy in the wake of the Ruby on Rails SQL injection vulnerability, or if anyone has any thoughts on it. Or worse, if it's going to tar SQLA with the same brush. This is pure conjecture, and should be taken with a giant grain

Re: [sqlalchemy] wake of RoR sql injection vulnerability

2013-01-09 Thread Iain Duncan
with other ORMs, so in that sense whatever failures RoR is bringing aren't really anything new. On Jan 9, 2013, at 11:57 AM, Iain Duncan wrote: Just curious as to whether anyone has seen changes in interest in SQLAlchemy in the wake of the Ruby on Rails SQL injection vulnerability

Re: [sqlalchemy] query joining and filtering with table inheritance

2012-09-28 Thread Iain Duncan
?highlight=of_type#basic-control-of-which-tables-are-queried Ladislav Lenart PS: I'm by no means a DB or SQLA expert too :-) Od: Iain Duncan iainduncanli...@gmail.com First off, sorry if it turns out that what I'm trying to do is smoke crack here, I'm by no means a DB or SQLA expert

[sqlalchemy] query joining and filtering with table inheritance

2012-09-27 Thread Iain Duncan
First off, sorry if it turns out that what I'm trying to do is smoke crack here, I'm by no means a DB or SQLA expert. =) I have two classes, Person and Organization, that use table inheritance to inherit from Contact. ( Person.id is an fkey to Contact.id ), which is working fine. I want to

[sqlalchemy] Saas deployment suggestions for SQLAlchemy?

2012-05-01 Thread Iain Duncan
Hey all, we've been using SQLAlchemy for about 5 years now, currently with Pyramid, but have not ever deployed to anything other than a standard vps for a one client install. We're now gearing up to make some of our products available as monthly subscriptions, and am looking for opinions and

[sqlalchemy] help decrypting exception re session management error?

2011-12-19 Thread Iain Duncan
Ok, I know this is my fault but maybe someone can help me know what kind of error I'm producing here, in saving a user, I'm getting the following expection, but only occasionally ( like 10% of the time? ) 15:13:18,160 INFO [xornot.dram.views] EditAction.post() Exception from self.update: Can't

[sqlalchemy] Meetup group in Vancouver BC

2011-12-08 Thread Iain Duncan
Hey all, I just created a meetup group in Vancouver BC for Pyramid and Pylons users. I'm wondering if I should really make it Pyramid/Pylons/SQLAlchemy. At any rate, SA certainly seems to be the most popular persistence mechanism for Pyramid. If you're in Van, I'd love to hear from you.

[sqlalchemy] sqla on app engine?

2011-10-08 Thread Iain Duncan
Hey folks, just saw the announcement that google appengine now has an sql backend: http://code.google.com/apis/sql/ I don't know near enough about app engine to understand whether this means we could use SQLAlchemy on it now, would love to hear from those who do! thanks Iain -- You received

Re: [sqlalchemy] sqla on app engine?

2011-10-08 Thread Iain Duncan
- in any case it would likely be based on mysql.dialects.mysql and not require very much code at all.It's just a matter of someone getting a basic hello world test running on GAE to get started.I'm just not sure how one runs unit tests on GAE. On Oct 8, 2011, at 4:06 PM, Iain Duncan

Re: [sqlalchemy] Re: replacing or altering a mapper?

2011-04-23 Thread Iain Duncan
Right, I didn't do a thorough job of explaining it, so I agree with the your assessment of the monkey patch, but my pattern isn't quite what you described ( because of my poor explanation! ). I'm using Pyramid and taking advantage of the Zope Component Architecture quite a bit. So there is a

[sqlalchemy] replacing or altering a mapper?

2011-04-22 Thread Iain Duncan
Hi folks, hoping someone can help here, couldn't figure it out from the mapper docs. I have some mappers being created in modules that are loaded separately. That has to stay that way, essentially our framework has base modules that get reused and they have ZCA utilities registered that make

[sqlalchemy] Re: replacing or altering a mapper?

2011-04-22 Thread Iain Duncan
mappers only support the addition of new attributes after construction.   There is of course clear_mappers() but that removes the entire graph of mappers (emphasis on graph, which is why we don't get into the surgical removal of individual mappers).   There is also the prospect of creating

Re: [sqlalchemy] Re: replacing or altering a mapper?

2011-04-22 Thread Iain Duncan
mappers only support the addition of new attributes after construction. There is of course clear_mappers() but that removes the entire graph of mappers (emphasis on graph, which is why we don't get into the surgical removal of individual mappers). There is also the prospect of creating

[sqlalchemy] Re: how to make a transaction fail for testing?

2009-12-14 Thread iain duncan
thanks Alex. I guess for integration tests one could also monkey patch it to override the commit method? thanks iain On Dec 13, 2:47 pm, Alex Brasetvik a...@brasetvik.com wrote: On Dec 13, 2009, at 22:25 , iain duncan wrote: Hey folks, I'm wondering how I can make a transaction fail

[sqlalchemy] how to make a transaction fail for testing?

2009-12-13 Thread iain duncan
Hey folks, I'm wondering how I can make a transaction fail deliberately for testing how my transaction handling code is working. Is there some simple mechanism for making sure a section in a try block with session.commit() raises an exception without altering the code? thanks Iain -- You

[sqlalchemy] Re: auto-creating one-to-one relations with the orm?

2009-05-03 Thread Iain Duncan
On Sun, 2009-05-03 at 09:43 -0400, Michael Bayer wrote: On May 2, 2009, at 8:16 PM, Iain Duncan wrote: On Sat, 2009-05-02 at 09:41 -0400, Michael Bayer wrote: you'd set cascade=all, delete-orphan on the Purchase.registration side (in this case its your backref). Thanks Mike

[sqlalchemy] Re: auto-creating one-to-one relations with the orm?

2009-05-02 Thread Iain Duncan
the mapper? Iain On May 2, 2009, at 1:42 AM, Iain Duncan wrote: Hi all, I have a mapper that looks like this: mapper( Registration, registration_table, properties={ 'purchase': relation(Purchase, backref=backref('registration', uselist=False), cascade='all

[sqlalchemy] auto-creating one-to-one relations with the orm?

2009-05-01 Thread Iain Duncan
Hi all, I have a mapper that looks like this: mapper( Registration, registration_table, properties={ 'purchase': relation(Purchase, backref=backref('registration', uselist=False), cascade='all' ), }) My registration table has a foreign key to purchases, and I want to make sure no

[sqlalchemy] Re: Clearing out a scoped session

2009-03-29 Thread Iain Duncan
Yes, the seed class makes new objects that I want in the db as fixture. I want to use the class as a namespace for a standard set of fixture objects, mostly because of the ease of setting it up that gives me, and because I can do things like make variants of the standard fixture with

[sqlalchemy] Re: Clearing out a scoped session

2009-03-28 Thread iain duncan
Thanks Mike. I made some progress ( I think! ). I now have the test class setup method successfully creating a new scoped session on each pass, and the objects that were created originally in a turbogears session context are being saved into that session and flushed to the db. I think this is the

[sqlalchemy] Re: Clearing out a scoped session

2009-03-28 Thread iain duncan
On Mar 28, 8:05 am, Michael Bayer mike...@zzzcomputing.com wrote: the error means the object was loaded from the database in some session.   it can't be sent to save().   if you send it to save_or_update() or add(), it's already INSERTed as far as SQLA is concerned. each test you create

[sqlalchemy] Re: Clearing out a scoped session

2009-03-28 Thread iain duncan
I guess the real issue is how do I negate: it's already INSERTed as far as SQLA is concerned. The tables are being dropped and recreated as part of the setup method, so I want SA not to know *anything* about any objects again. I was under the impression that a new session would do it, which was

[sqlalchemy] Re: Clearing out a scoped session

2009-03-28 Thread iain duncan
On Mar 28, 2:21 pm, Michael Bayer mike...@zzzcomputing.com wrote: iain duncan wrote: Thanks Mike. I figured this is probably not the intended use. The thing is, I'm trying to make a declarative template for test seed data and declaring it all in a class like so makes for the easiest

[sqlalchemy] Clearing out a scoped session

2009-03-27 Thread iain duncan
Hi folks, I'm working on a set of test utilities for functional tests using SA. Because they use a turbogears model, they import the tg model and so get the SA class definitions with the mappers from the TG scoped_session. My problem is that I want to reseed this data on each test. So I have a

[sqlalchemy] Re: problems with py2app

2008-04-26 Thread iain duncan
26, 7:53 am, iain duncan [EMAIL PROTECTED] wrote: Hi folks, I seem to be having a problem with sqlalchemy and py2app, but I am very new to OS X and py2app, so I could be doing something stupid. When we try to build the app we get this: ImportError: No module named logging Traceback (most

[sqlalchemy] problems with py2app

2008-04-25 Thread iain duncan
Hi folks, I seem to be having a problem with sqlalchemy and py2app, but I am very new to OS X and py2app, so I could be doing something stupid. When we try to build the app we get this: ImportError: No module named logging Traceback (most recent call last): File

[sqlalchemy] Re: Ensuring a clean database for each test case

2008-04-18 Thread iain duncan
How can I realize this concept of a completely new and isolated DB environment for each single test case that's being run? Not sure if this is a useful answer or not, but I just made starting sql files for each of my test suites. It's an extra step but then you have a convenient file to put

[sqlalchemy] Re: mappers for having problems with associations and flushing

2008-04-14 Thread iain duncan
here are my mappers in case that helps, maybe I don't understand the cascading properly? # relations for the bookings mapper( Booking, booking_table, properties={ 'client': relation( Client ), 'institution': relation( Institution, ), 'category': relation( Category ),

[sqlalchemy] Re: Extension proposal

2008-04-14 Thread iain duncan
On Mon, 2008-14-04 at 10:26 -0400, Michael Bayer wrote: On Apr 14, 2008, at 10:11 AM, Paul Johnston wrote: Hi, In my case, the data is coming from FormEncode. I guess it could come from JSON, but that would be JSON client to server, which is not the usual way round. JSON is

[sqlalchemy] Re: Stuck on flush vs commit problems

2008-04-13 Thread iain duncan
On Sun, 2008-13-04 at 11:28 -0400, Michael Bayer wrote: On Apr 12, 2008, at 5:39 PM, iain duncan wrote: File /home/xornot/www/booking/booking-wx/model.py, line 227, in update_resource_obj session.flush(resource_obj) File /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.3-py2.4

[sqlalchemy] Stuck on flush vs commit problems

2008-04-12 Thread iain duncan
Hi everyone, I'm stuck going around in circles here so any help would be great. I don't know whether I should be using transactions or not to solve this, but haven't got it working yet with either flushes or commits. Problem: - a gui app manages two resources, bookings and clients - bookings

[sqlalchemy] Re: Stuck on flush vs commit problems

2008-04-12 Thread iain duncan
Narrowing it down, I guess what I'm really confused about is why, given two booking objects, in complete and ok to save and one not, I can't do session.save_or_update( complete_booking ) session.flush( complete_booking ) ( keeping booking incomplete around until later ) On the other hand I

[sqlalchemy] Re: A General Thank You

2008-02-11 Thread iain duncan
On Sat, 2008-19-01 at 17:48 -0500, Michael Bayer wrote: youre very welcome ! glad you've had a positive experience. Yeah, the SA docs are awesome. The whole package is awesome. I was recently really impressed with how easy it was to migrate to 0.4. Iain

[sqlalchemy] Re: 0.4 deprecation warnings, what is the new get_by/select_by?

2007-12-20 Thread iain duncan
On Thu, 2007-20-12 at 09:58 +0100, Gaetan de Menten wrote: On Dec 20, 2007 8:50 AM, iain duncan [EMAIL PROTECTED] wrote: Sorry if this seems a stupid question, but I thought that Mike had said that in sa0.4, if you used session_context that this User.query.get_by(name='john

[sqlalchemy] 0.4 deprecation warnings, what is the new get_by/select_by?

2007-12-19 Thread iain duncan
Sorry if this seems a stupid question, but I thought that Mike had said that in sa0.4, if you used session_context that this User.query.get_by(name='john') was the replacement for the old assign mapper convenience call. But I'm getting deprecation warnings. What should I be doing instead of

[sqlalchemy] Doc bug? 0.3 tutorial not working

2007-11-17 Thread iain duncan
Hi Michael et al. I don't know if this is a versioning conflict or what not. I know I had done this fine before in the past, so maybe something changed. Anyway, with sa 0.3.11 and python 2.4.3 and mysql 5.0.22, following the sa 0.3 tutorial: from sqlalchemy import * db =

[sqlalchemy] Re: Doc bug? 0.3 tutorial not working

2007-11-17 Thread iain duncan
from sqlalchemy import * db = create_engine('mysql://web:[EMAIL PROTECTED]/db_name') metadata = MetaData() metadata.bind(db) TypeError: 'NoneType' object is not callable However this still works: metadata = MetaData(db) The tutorial still says the two are equivalent, so I

[sqlalchemy] Re: stuck on self referrencing mapper thingy WORKING, thanks

2007-11-10 Thread iain duncan
OK this is what happens here, the relationship you want to establish is: product_table (product_table.id=collections.parent_id)--- collections (collections.child_id=product_table.id) product_table so above, youve got product_table.id, youve got the collections table

[sqlalchemy] stuck on self referrencing mapper thingy

2007-11-09 Thread iain duncan
I've tried to find something similar in the SA 0.3 docs but haven't managed yet. They are dense though so I could easily have missed something. Apologies if this seems a simple problem! :/ I have a product table, some are allowed to be collections ( ie gift basket. ) They will have children,

[sqlalchemy] rlike with assign_mapper?

2007-11-01 Thread iain duncan
Others gave some pointers a while back on using rlike with query filters. I'm wondering whether there is some way to get rlike with assign_mapper syntax? I'm using right now Resource.select_by( **query_dict ) where query dict is name/val pairs, I'd like to be able to make those name/val pairs

[sqlalchemy] Re: vote for Python - PLEASE!

2007-10-21 Thread iain duncan
On Fri, 2007-19-10 at 17:06 -0700, Monty Taylor wrote: Daniel Haus wrote: Looks like you're frighteningly successful. You're right, python could use much more love, but look at this! Obviously the poll is not representative anymore, is it... Yeah - a little skewed there. On the other

[sqlalchemy] Re: RLIKE, REGEXP

2007-10-21 Thread iain duncan
On Wed, 2007-10-10 at 16:41 -0700, jason kirtland wrote: Jim Musil wrote: I don't see support for RLIKE, NOT RLIKE, or REGEXP anywhere. Is there support for this? Yes, you can use these operators and any others via the .op() method: table.c.col1.op('rlike')('re')

[sqlalchemy] Re: RLIKE, REGEXP

2007-10-21 Thread iain duncan
On Sun, 2007-21-10 at 17:12 -0400, Michael Bayer wrote: On Oct 21, 2007, at 4:36 PM, Paul Johnston wrote: Hi, Resource.select_by( foo=bar ) Untested, but I reckon this will work: Resource.query.filter(Resource.foo.op('rlike')('bar')) might need to call op() off the

[sqlalchemy] deletion behavior question

2007-02-12 Thread iain duncan
I would like some objects that are related through many to many tables to delete the many to many entry on deletion, but NOT the endpoint. It seems that cascade=all deletes both, and no arg to cascade leaves left over invalid entries in the manytomany table. Is there a suggested way to deal with

[sqlalchemy] offlist thanks Re: [sqlalchemy] Re: making crud with assign_mapper

2007-02-07 Thread iain duncan
On Wed, 2007-07-02 at 11:53 +0200, svilen wrote: If you have the time and know how, do you know what the efficient way to iterate through all the class definitions in a module would be to grab all the classes that have a certain member? import module for k,v in

[sqlalchemy] Re: offlist thanks Re: [sqlalchemy] Re: making crud with assign_mapper

2007-02-07 Thread iain duncan
Darn, apologies to all. Clearly I am too sleepy to be doing this as I can't even work my mail client. :/ Thanks On Wed, 2007-07-02 at 01:58 -0800, iain duncan wrote: On Wed, 2007-07-02 at 11:53 +0200, svilen wrote: If you have the time and know how, do you know what the efficient way

[sqlalchemy] Re: Using assoc proxy with a regular field, help?

2007-02-06 Thread iain duncan
On Tue, 2007-06-02 at 06:25 -0200, Roger Demetrescu wrote: Hi iain On 2/5/07, iain duncan [EMAIL PROTECTED] wrote: Below is my code in case someone has time to look at it. At the moment it works to get article.ordering as a list instead of one field. Is there a way to tell

[sqlalchemy] Using assoc proxy with a regular field, help?

2007-02-05 Thread iain duncan
Hi folks. I have worked my way through the association and association proxy examples and almost got what I want going, but I'm stuck on a couple of points. I have an assoc table with two foreign keys and one extra numerical field. In the example in the docs, the third extra field is a third

[sqlalchemy] Re: sqlalchemy lost connection?

2007-02-04 Thread iain duncan
On Sun, 2007-04-02 at 10:33 -0200, Jorge Godoy wrote: iain duncan [EMAIL PROTECTED] writes: ridiculous but at least it works. I suppose in the case of a web app the cron job could even be on any old server using wget. I'd put the cron job on the same server as the app... :-) The load

[sqlalchemy] Re: sqlalchemy lost connection?

2007-02-04 Thread iain duncan
On Sun, 2007-04-02 at 22:00 +, Michael Bayer wrote: three people have replied to this user and nobody has referenced the documented (as well as FAQ'ed) feature specifically built to deal with this ?! sorry im so cranky...but man you guys have to help me a little more :) use

[sqlalchemy] doc bug for Association Object example code

2007-02-04 Thread iain duncan
Not sure if this is the right place, hope so. In the example for Association Object on http://www.sqlalchemy.org/docs/datamapping.myt#datamapping The bottom part reads: for a in alist: for k in a.keywords: if k.keyword.name == 'jacks_stories': print k.user.user_name

[sqlalchemy] Re: Assign mapper many-to-many with extra columns

2007-02-03 Thread iain duncan
On Fri, 2007-02-02 at 21:41 -0500, Karl Guertin wrote: Did my suggestion of dropping 'ordering' off of the article and adding an order_by clause to the relation not work? # article mapper assign_mapper( session.context, Article, article_table) # page mapper with m-to-m relation on

[sqlalchemy] Re: sqlalchemy lost connection?

2007-02-03 Thread iain duncan
On Sat, 2007-03-02 at 20:53 -0500, Mike Bernson wrote: Mysql has a timeout idle connection. You might be running into this. I think it defaults to 8 hours It sounds like you are running into the idle timeout. dischdennis wrote: Hi I am using sqlalchemy with zope and when I have the

[sqlalchemy] Re: Assign mapper many-to-many with extra columns

2007-02-03 Thread iain duncan
On Sat, 2007-03-02 at 18:44 -0500, Karl Guertin wrote: On 2/3/07, iain duncan [EMAIL PROTECTED] wrote: InvalidRequestError: Given column 'page_article.ordering', attached to table 'page_article', failed to locate a corresponding column from table 'article_36c9' I'd think that you're