[sqlalchemy] Reentrant data population script using sql alchemy

2009-08-09 Thread gizli
Hi all, Forgive me if this is a very basic question but I could not find the answer anywhere. I am trying to write a data population script to setup a few tables and insert some data in them. I need to make this script reentrant.. The problem is that currently the script looks like this: get a

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread Ross Vandegrift
On Fri, Aug 07, 2009 at 09:39:33AM -0700, allen.fowler wrote: As an aside, I wonder if it is possible to just subclass my Records object so that the CurrentRecords class adds/enforces certain filter_by parameters for any query against it. Yes - SA's ORM can map to arbitrary Selectable object.

[sqlalchemy] Re: Reentrant data population script using sql alchemy

2009-08-09 Thread Michael Bayer
On Aug 8, 2009, at 10:58 PM, gizli wrote: Hi all, Forgive me if this is a very basic question but I could not find the answer anywhere. I am trying to write a data population script to setup a few tables and insert some data in them. I need to make this script reentrant.. The problem

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread allen.fowler
On Aug 7, 11:45 am, Michael Bayer mike...@zzzcomputing.com wrote: AF wrote: Hello, I have a table of records in the database that I want to run read queries against, but I do want to include all of them in the search. (There are a couple of filtering parameters to exclude records

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 1:24 PM, allen.fowler wrote: So, just to clarify: At this point in time, can SQLAlchemy be used to define and query simple VIEWs in a database agnostic manner? And if not, is this a feature that is slated for addition any time soon? CREATE VIEW is almost identical

[sqlalchemy] Re: Materialized Path for SQLAlchemy Declarative Base

2009-08-09 Thread allen.fowler
Werner, On Aug 7, 12:36 pm, werner wbru...@free.fr wrote: Allen, allen.fowler wrote: On Aug 6, 6:54 pm, AF allen.fow...@yahoo.com wrote: Hello all, Has anyone here used the sqlamp: Materialized Path for SQLAlchemy library? I am wondering: 1) Does it seem to work well? 2)

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread allen.fowler
On Aug 9, 1:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 9, 2009, at 1:24 PM, allen.fowler wrote: So, just to clarify: At this point in time, can SQLAlchemy be used to define and query simple VIEWs in a database agnostic manner? And if not, is this a feature that is

[sqlalchemy] Re: VIEW alternative in SQLAlchemy

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 5:36 PM, allen.fowler wrote: Still, though, it looses the auto generation capability via drop_all()/ create_all() vs. traditional tables and feels out-of-place along side the rest of SQLAlchemy's slickness. I still have the job of documenting 0.6's features, but even

[sqlalchemy] Adding method to ORM mapped object

2009-08-09 Thread Andreas
Hi! I was just curious, if it is possible to add a method to an ORM mapped object, because I'd like to assemble a string within that object. Here's what I'd like to do: class page(): def __init__(self, name, title, content): self.name = name self.title = title

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 9:00 PM, Andreas wrote: Hi! I was just curious, if it is possible to add a method to an ORM mapped object, because I'd like to assemble a string within that object. Here's what I'd like to do: class page(): def __init__(self, name, title, content):

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Andreas
On Aug 10, 3:18 am, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 9, 2009, at 9:00 PM, Andreas wrote: The problem ist that the mapper call overwrites anything, I can't access getRendered the normal way. Is there an easy work'round or do I have to assemble the rendered output

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 9:35 PM, Andreas wrote: On Aug 10, 3:18 am, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 9, 2009, at 9:00 PM, Andreas wrote: The problem ist that the mapper call overwrites anything, I can't access getRendered the normal way. Is there an easy work'round or do

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Andreas
Arghh... I got it. The problem was that I wasn't querying through a session, but doing a selection without one, so the object wasn't bound to the class ... Some old code fragment. Quite as you said. Thanks for your help :) --~--~-~--~~~---~--~~ You received this