Hi All,
I'm working on a variation of this recipe:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/VersionedRows
...and I've got a couple of questions about changed objects:
- do objects end up in session.dirty as a result of attributes being set
or changed?
For example:
class
zende wrote:
Base.metadata.drop_all() completely blocks in the tearDown method of
some of my tests.
What database backend are you using *in the tests*?
Where is the code blocking? (ie: when you hit ctrl-c, you should get a
traceback, it would be handy to see that...)
cheers,
Chris
--
Oliver Beattie wrote:
@property
def is_visible(self):
return (self.enabled and not self.is_deleted)
This can clearly be mapped quite easily to SQL expression
`Klass.enabled == True Klass.is_deleted == False`
You could always add a class-level attribute that stored this...
thatsanicehatyouh...@mac.com wrote:
This is a bit tricky to explain. Imagine I have one database, and I create a
project (1) to work with that database (connections, table class definitions,
etc.). That is standalone (to me). I have another completely separate database
(2) on another host
Here's the source code of my test - let me know if I'm doing anything wrong
here
from sqlalchemy import create_engine
from sqlalchemy.orm import mapper
from sqlalchemy.sql.expression import join
from sqlalchemy.orm.session import sessionmaker
from sqlalchemy.schema import MetaData
import
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of
thatsanicehatyouh...@mac.com
Sent: 07 July 2010 20:33
To: sqlalchemy@googlegroups.com
Subject: Re: [sqlalchemy] Using the declarative base across projects
Hi Lance,
Thanks
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Chris Withers
Sent: 08 July 2010 09:28
To: sqlalchemy@googlegroups.com
Subject: Re: [sqlalchemy] Comparable properties
Oliver Beattie wrote:
@property
def
King Simon-NFHD78 wrote:
@hybrid
def is_visible(self):
return (self.enabled == True) (self.is_deleted == False)
Yeah, having to write something that works as both plain python and a
sql layer construct seems a little brittle.
I wonder if a decorator could be knocked up which would
Hi All,
I'm a bit surprised to find that you have to ask for the new C
extensions in 0.6 to be explicitly compiled.
It also appears that the way of requesting this isn't compatible with
build tools like a pip requirements file or buildout.
What was the reason for that? If it was purely in
Hi All,
Where can I find documentation of the History objects used by the orm layer?
In particular, how come each of .added, .unchanged and .deleted is a
sequence?
Are history objects always around or is there a performance hit for
using them?
cheers,
Chris
--
You received this message
Hi All,
My flow of questions continues ;-)
What's the difference beween make_transient(instance), where I guess
make_transient comes from sqlalchemy.org, and session.expunge(instance)?
cheers,
Chris
--
You received this message because you are subscribed to the Google Groups
sqlalchemy
Chris Withers wrote:
Hi All,
My flow of questions continues ;-)
What's the difference beween make_transient(instance), where I guess
make_transient comes from sqlalchemy.org,
...er, that's sqlachemy.orm...
Chris
--
You received this message because you are subscribed to the Google Groups
'''
For some reason, when I define my class seems to impact sqlalchemy
Below is code where if the class Formation(Library): pass line is
moved down,
it works, but as is, I get the error at the end of this file, raised
when the last line runs
This seems very odd (and bug like) to me, and I'm
On Jul 8, 2010, at 6:30 AM, Chris Withers wrote:
Hi All,
I'm a bit surprised to find that you have to ask for the new C extensions in
0.6 to be explicitly compiled.
It also appears that the way of requesting this isn't compatible with build
tools like a pip requirements file or
On 7/8/2010 3:23 AM, Chris Withers wrote:
Hi All,
I'm working on a variation of this recipe:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/VersionedRows
...and I've got a couple of questions about changed objects:
- do objects end up in session.dirty as a result of attributes being
set
On Jul 7, 2010, at 10:52 PM, Craig Macomber wrote:
'''
For some reason, when I define my class seems to impact sqlalchemy
Below is code where if the class Formation(Library): pass line is
moved down,
it works, but as is, I get the error at the end of this file, raised
when the last line
Lance Edgar wrote:
- do objects end up in session.dirty as a result of attributes being
set or changed?
Setting an attribute is enough for the instance to wind up in
Session.dirty, according to
http://www.sqlalchemy.org/docs/reference/orm/sessions.html#sqlalchemy.orm.session.Session.dirty
Michael Bayer wrote:
http://svn.zope.org/zope.interface/trunk/setup.py?view=auto
we wanted to annoy buildout/setuptools/Glyph as much as possible, and I am
happy to say we succeeded.
I hope you're joking :-S
The issue of them not building by default wasn't that they might not build, just
On Jul 8, 2010, at 10:43 AM, Chris Withers wrote:
Michael Bayer wrote:
http://svn.zope.org/zope.interface/trunk/setup.py?view=auto
we wanted to annoy buildout/setuptools/Glyph as much as possible, and I am
happy to say we succeeded.
I hope you're joking :-S
The issue of them not
Michael Bayer wrote:
Not sure if we'd want to change this default midway through 0.6 or wait til 0.7.
Fair enough, but this is sadly one of those things where you're only likely to find the
edge cases when you do make it on by default...
The C exts also don't improve performance that much
Thank you. I was hoping it was something like that as I couldn't see
anything else that would make sense.
On Jul 8, 6:52 am, Michael Bayer mike...@zzzcomputing.com wrote:
On Jul 7, 2010, at 10:52 PM, Craig Macomber wrote:
'''
For some reason, when I define my class seems to impact
Excerpts from zende's message of Thu Jul 08 13:27:27 -0300 2010:
I reproduced the issue the script below:
http://gist.github.com/468199
Sorry for the weak explanation before. This has little to do with
being in tests except that's the only code that drops and creates
the db for any reason.
Mariano, What db? postgres?
On Jul 8, 9:41 am, Mariano Mara mariano.m...@gmail.com wrote:
I'm on a similar situation. For lack of time I couldn't investigate it
yet but I have a drop_all when running nosetests in my pylons project
and it get stuck while dropping the tables. I have to kill the
Your scoped session still has an active connection, which is blocking
the drop. Call session.remove() before the drop, or configure the
session with expires_on_commit=False to not issue SELECTs to fetch
object state after the final commit().
On Thu, Jul 8, 2010 at 9:27 AM, zende
Excerpts from zende's message of Thu Jul 08 14:01:32 -0300 2010:
Mariano, What db? postgres?
On Jul 8, 9:41 am, Mariano Mara mariano.m...@gmail.com wrote:
I'm on a similar situation. For lack of time I couldn't investigate it
yet but I have a drop_all when running nosetests in my pylons
Jason, in the contrived example I came up with and posted, your
solution worked but not in my tests. I tried both
expires_on_commit=False and Session.remove() before the drop with no
luck. Thanks for the suggestion
On Jul 8, 10:03 am, jason kirtland j...@discorporate.us wrote:
Your scoped
I'd be interested in prototyping a WithClause or something similar if
you think it might be useful.
I imagine it would have similar semantics to a FromClause but would be
prepended to the query. Currently, I'm not too interested in
prototyping the RECURSIVE part and only care about Postgres.
Hi All,
Say we have the following model:
class Price(Base):
__tablename__ = 'price'
id = Column(Integer, primary_key=True)
value = Column(Numeric(precision=36, scale=12))
class Instrument(Base):
__tablename__ = 'instrument'
id = Column(Integer, primary_key=True)
ticker
I'd really be interested in defining a system that covers WITH / RECURSIVE
entirely, and makes sense both with PG / SQL server as well as Oracle.The
work here is figuring out what is common about those two approaches and what an
API that is meaningful for both would look like.
On Jul 7, 2010, at 3:19 PM, Nikolaj wrote:
Hi there,
I'd like to create a column composite for amounts of money and their
currency. However, the difficulty comes in keeping the currencies in a
separate table and enabling my composite to find this relationship.
Is there some way to set
On Jul 8, 2010, at 2:42 PM, Chris Withers wrote:
Hi All,
Say we have the following model:
class Price(Base):
__tablename__ = 'price'
id = Column(Integer, primary_key=True)
value = Column(Numeric(precision=36, scale=12))
class Instrument(Base):
__tablename__ =
That's a fair point.
I think one interface might be casting a FromClause into a WithClause
similar to how one would alias something.
With postgres it seams like when going from a WITH to WITH recursive
is adding a UNION ALL and the recursive term. Throwing out an idea for
an interface (for
Sorry, google groups formatted that *really* poorly.
On Jul 8, 12:28 pm, Mike Lewis mikelikes...@gmail.com wrote:
That's a fair point.
I think one interface might be casting a FromClause into a WithClause
similar to how one would alias something.
With postgres it seams like when going from
On Jul 8, 2010, at 3:28 PM, Mike Lewis wrote:
That's a fair point.
I think one interface might be casting a FromClause into a WithClause
similar to how one would alias something.
With postgres it seams like when going from a WITH to WITH recursive
is adding a UNION ALL and the recursive
nope. Jason was right :D. I needed to add Session.remove() to my
threads as well; though, I'm not sure why adding
expires_on_commit=False alone didn't solve it. Oh well, works now
Thanks!
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
Michael Bayer wrote:
class Allocation(Base):
__tablename__ = 'data'
id = Column(Integer, primary_key=True)
trade_id = Column(Integer, index=True)
instrument_id = Column(ForeignKey(Instrument.id))
instrument = relationship(Instrument)
quantity = Column(Integer)
price_id =
I have been, naively it seems, using multiple declarative Base classes
in my webapp. They all share the same metadata object.
I have found one negative ramification of this, which is that string
references (like what can be used in relation()) won't find the object
if they are not using the same
I'm glad you brought this up. It seems to me that the the declarative
instrumentation keys classes by their unqualified class name,
precluding using the same class name for different declarative
subclasses (ie, in different modules).
On Jul 9, 12:01 pm, Randy Syring ra...@rcs-comp.com wrote:
38 matches
Mail list logo