On Aug 13, 2:37 pm, Anton Gritsay wrote:
> Hi, Allen!
>
> You can use something like this (yeah, I know that it isn't
> declarative in any way):
>
> class Node(Base):
> __tablename__ = 'node'
> id = Column(Integer, primary_key=True)
> parent_id = Column(ForeignKey('n
On Aug 9, 1:42 pm, Michael Bayer 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,
Werner,
On Aug 7, 12:36 pm, werner wrote:
> Allen,
>
> allen.fowler wrote:
>
> > On Aug 6, 6:54 pm, AF wrote:
>
> >> Hello all,
>
> >> Has anyone here used the "sqlamp: Materialized Path for SQLAlchemy"
> >> library?
>
> >&g
On Aug 7, 11:45 am, "Michael Bayer" 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 from
> > the se
> ...> To clarify:
>
> > I am using SQLAlchemy's Declarative Base to fully define and create my
> > database.
>
> > For instance, there is a simple class/table Records, and I would like
> > to define a class CurrentRecords that is implemented in the database
> > as a view on Records.
>
> > In thi
On Aug 7, 11:45 am, "Michael Bayer" 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 from
> > the se
On Aug 6, 6:54 pm, AF 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) Did you use it with Declarative Base, and if so, how did you
> configure it?
>
Anybody?
Specifically, I am
On Aug 6, 4:05 pm, "Michael Bayer" wrote:
> allen.fowler wrote:
>
> >> I tried:
>
> >> children = relation("Node", backref=backref("parent",
> >> remote_side="nodes.id"))
>
> > got it to work with:
>
> &
> I tried:
>
> children = relation("Node", backref=backref("parent",
> remote_side="nodes.id"))
>
got it to work with:
remote_side=[id]
But:
1) Why is remote_side a list?
2) Where does single_parent fit in to this?
--~--~-~--~~~---~--~~
You received this messa
On Aug 5, 6:29 pm, AF wrote:
> Hello,
>
> Where do you folks recommend storing the database connection string in
> my application. Clearly not in the same file with my declaratively
> defined model objects.
>
> And more generally, how do you recommend laying out an SQLAlchemy
> based applicati
On Aug 6, 4:59 am, Wichert Akkerman wrote:
> On 8/6/09 09:30 , werner wrote:
>
> > IIRC correctly the __init__ section is only needed if you want to do:
> > add = Address('an email address')
>
> > I never do this, i.e. I assign like this
> > add = Address()
> > add.email_address = 'an email add
On Aug 6, 3:30 am, werner wrote:
> I never do this, i.e. I assign like this
> add = Address()
> add.email_address = 'an email address'> In what way is the Address object
> expected to be instantiated such
> > that it receives the correct user id?
>
> You just do this and SA will take care of
On Jul 28, 12:17 pm, David Gardner wrote:
> Just thought I would toss in my 2-cents here, since I have lots of
> hierarchical data and have
> at one time or another used most of the below methods.
>
> Choice #1 is the option that I have found that works the best.
> I Use a file path-like primar
> I've attached a proof of concept for how I've approached the "homegrown"
> version of this in the past. a jobs table has two update passes - one to
> atomically mark jobs as "in progress" by a certain procid, then the
> transaction is released so that other processes can theoretically work on
On Jun 30, 11:25 am, Didip Kerabat wrote:
> If you are open to non RDBMS solution, sounds like what you need is message
> queue system.
>
> At work, we use RabbitMQ (memory-only) and have been quite happy with it.
>
> SecondLife posted their discovery about MQ
> here:http://wiki.secondlife.com
> > I have several CGI and cron scripts and that I would like coordinate
> > via a "First In / First Out" style buffer. That is, some processes
> > are adding work units, and some take the oldest and start work on
> > them.
>
> > Since I need the queue to both survive system crashes and provid
> If you have mapper definitions separate from classes, theres nothing
> stopping you from adding attributes to the class over there, i.e.
>
> mapper(MyClass, mytable)
>
> MyClass.foo = some_validation_decorator(MyClass.foo)
>
> Personally I wouldn't bother (then again I use declarative for every
> default = lambda: random.randrange(1000,1)
>
Seems we crossed in the interwebs.. :)
Is it safe to do this, or do you need to do default = lambda:
random.Random()randrange(1000,1) ?
I ask since I have several tables that this needs to be applied to.
Thank you
--~--~-~--~
OK, never mind... I solved it.
The default = random.randrange(1000,1) code was happily taking the
static return value. Duh.
I changed it to:
default = lambda: random.Random().randrange(2000,8000)
I dunno if the extra Random() is needed, but it can't hurt, right?
On Jun 21, 4:32 pm, AF
Thank you, Michael.
On Jun 18, 9:41 am, Michael Bayer wrote:
> On Jun 18, 2009, at 2:27 AM, AF wrote:
>
>
>
> > OK, next question.
>
> > Well... two related questions. :)
>
> > 1) In general, inside an object's method def, where I am doing
> > arbitrary calculations, how can I get access to t
> you can, you can use a validator that rejects all changes, or if
> you're
> brave you can create a custom __setattribute__ method that brokers all
> attribute setter access. the former is in the SQLA mapping docs the
> latter is part of Python.
Thank you. Interesting seems a bit of a ro
> 3) Can this relation's objects be made "read-only"? That is:
> "u.room = new_room" would work, but this would not: "u.room.name =
> 'kitchen'"
>
To clarify the question:
Can this objects seen via this relation be made "read-only"? That is:
u.room = a_room
u.room = a_new_room
...would work
On Jun 17, 6:39 am, Mike Conley wrote:
> users.room is the id of a room, not an actual room
>
> u.room = r.id
>
> will fix the problem
>
> However, if you want to use a SA relation, you didn't declare it yet.
>
> You can do this to make a relation
>
> users_table = Table('users',
On Jun 12, 6:00 am, Gunnlaugur Briem wrote:
> The engine's conversion to unicode doesn't happen when you assign the
> property, it happens when the underlying database operation is
> committed, and arrives in the python object's property only after
> roundtripping through the database.
>
OK, i
Anybody?
On Jun 4, 1:13 am, AF wrote:
> Hello,
>
> I'm using sqlite and "convert_unicode = True "on the engine.
>
> How can I force coerce string based object attributes in to unicode?
> (I had thought "convert_unicode = True" would do this)
>
> Here is what I am seeing...
>
> Setup code:
> engi
25 matches
Mail list logo