I add a python property to my class, can i make this query able? Anyone
knows of a good sample on how to do this, I would really appreciate.
rgds,
Paulo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" gr
Hi all,
I observed that if I define a relation (foo_query) as lazy='dynamic' and
access all referenced entities with foo_query.all() that the query will
be executed every time i access it. That is not a big surprise ;-)
In a library I am writing i want to provide methods that allow
pre-filtering
Martijn Faassen wrote:
>
> Hey,
>
> [finding related objects]
>
> One way I've come up with is this:
>
>
> m = object_mapper(model)
> for prop in m.iterate_properties:
> if isinstance(prop, RelationProperty):
> if prop.direction is ONETOMANY:
> for related in getattr(mod
Hey,
[finding related objects]
One way I've come up with is this:
m = object_mapper(model)
for prop in m.iterate_properties:
if isinstance(prop, RelationProperty):
if prop.direction is ONETOMANY:
for related in getattr(model, prop.key):
do_stuff(rela
Michael Mileusnich wrote:
> I have a db file with a function called getsession() that returns my
> Session
> which has been established to = a scoped session. The odd thing is it
> works
> fine on my Windows XP machine, however on my ubuntu box it throws errors.
> I
> guess I'll reply later today
I have a db file with a function called getsession() that returns my Session
which has been established to = a scoped session. The odd thing is it works
fine on my Windows XP machine, however on my ubuntu box it throws errors. I
guess I'll reply later today with the errors.
Thanks
Michael Mileusn
Michael Mileusnich wrote:
> I have switched my application to use the Python multiprocessor threading
> instead if the default python gil threading. I seem to be running into
> issues. I am using scoped sessions and in my run() function, when I try
> to
> do sess = getsession() to grab the sessi
Hi there,
I'm trying to figure out whether there's something in SQLAlchemy that
lets me reliably get all the objects related to another: i.e. all
children of a parent that (in the underlying record) have a foreign key
relationship to the parent record.
One way I've been trying to solve this i
I have switched my application to use the Python multiprocessor threading
instead if the default python gil threading. I seem to be running into
issues. I am using scoped sessions and in my run() function, when I try to
do sess = getsession() to grab the session sql alchemy throws a large number
Hi!
I'm having trouble getting a query to work. The query looks rather
simple but I can't manage to build it using sqlalchemy - especially I
didn't find a way for the exists clause to build.
The query (simplified):
SELECT * from ATable WHERE EXISTS (
SELECT 1 FROM BTable join CTable on BTable
As expected, the simple test works. Something else is happening.
In [7]: cpaste
Pasting code; enter '--' alone on the line to stop.
:Base=declarative_base()
:Base.metadata.bind = create_engine('sqlite:///', echo=True)
:class Foo(Base):
:__tablename__ = 'foo'
:id = Column(Integer, primary_k
Now we are getting into areas beyond my SA understanding. Here is my test
with scoped_session that shows in version 0.5.5 that session.extension is
available and modifiable, don't know if it gets called but that would be
pretty easy to check. You might want to try the same test.
>>> import sqlalch
Hi,
Thank you for your interest.
Testing with this kind of declaration : session.extensions =
[VersionedListener()] doesn't change anything and using this kind of
declaration : session.extensions.append(MySessionExtension()) returns:
AttributeError: 'ScopedSession' object has no attribute 'exte
Well, it looks like configure is a class method on Session, so when you do
session.configure() you are configuring future sessions, not the current
one.
The extensions for a session instance are are a property named extensions.
You could try setting that list yourself.
session.extensions = [MySes
Small type : print session.is_active
On 10 sep, 14:07, Laurent Rahuel wrote:
> Here is a sample code:
>
> print session.is_active()
>
> class MySessionExtension(SessionExtension):
> print "Entering MySessionExtension"
> def before_flush(self, session, flush_context, instances):
>
Here is a sample code:
print session.is_active()
class MySessionExtension(SessionExtension):
print "Entering MySessionExtension"
def before_flush(self, session, flush_context, instances):
print "Entering method before_flush"
session.configure(extension=MySessionExtension())
# s
I also tried session.configure(extension=MySessionExtension()) with no
success
On 10 sep, 10:13, Laurent Rahuel wrote:
> Hi,
>
> I'm currently using a webframework which uses sqlalchemy. Each time a
> request hits the server, the framework creates a session object I can
> use during the page cr
Hi,
I'm currently using a webframework which uses sqlalchemy. Each time a
request hits the server, the framework creates a session object I can
use during the page creation.
I wish you could update this session with one of my SessionExtension but
I'm facing a small problem:
I tested my code
18 matches
Mail list logo