ecause the state of "p1" is "persistent" as opposed to
> "pending", so the example updates a row that isn't there.
>
> you need to build a copy constructor on Person and make a new,
> non-persistent Person object for your second engine. the Session can't
Hey I was wondering if it was possible to replace an engine in a
session. It does not seem to work, but maybe I'm doing something
really stupid.
http://pastie.org/322501
Kindest regards,
Koen Bok - madebysofa.com
--~--~-~--~~~---~--~~
You received this me
Yep, exactly that. It would speed up my (UI) app immensely. Any ideas
how to approach something like that?
On May 28, 5:07 pm, [EMAIL PROTECTED] wrote:
> some time ago i posted a list of my ideas along
> this..http://groups.google.com/group/sqlalchemy/browse_thread/thread/d88696...
>
>
>
> > be
Hey All,
I have a conceptual question.
You have two ways to get relations; lazy and nonlazy. Nonlazy works
great for saving queries but can get pretty slow with complicated
joins. So I was wondering if there was a third way; pre fetching all
the data for relations and let the mapper get the rela
Hey Iain,
If you build apps with py2app it tries to figure out which modules to
include automatically. If these modules are nested in some weird way
it sometimes chokes. A solution is to import that module by hand in
your main script (your-app-name.py) or telling py2app it needs to add
the module
Got it, thanks!
On Apr 16, 4:26 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Apr 16, 2008, at 10:13 AM, Koen Bok wrote:
>
>
>
> > Hey all,
>
> > Before 0.4.5 I used this code to get the mapped class for a table. It
> > worked fine, but mapper_reg
Hey all,
Before 0.4.5 I used this code to get the mapped class for a table. It
worked fine, but mapper_registry was made private in 0.4.5 and the
private function does not behave the same way for some reason. But as
this code is pretty nasty anyway I was wondering if there was a better
way to do
reign_keys=[pg_group.c.grolist],
_local_remote_pairs=[(pg_user.c.usesysid,
pg_group.c.grolist)])})
On Apr 14, 11:26 pm, Koen Bok <[EMAIL PROTECTED]> wrote:
> Wow that is fast!
>
> Thanks man ;-)
>
> On Apr 14, 5:51 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
&
Wow that is fast!
Thanks man ;-)
On Apr 14, 5:51 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Apr 14, 2008, at 7:44 AM, Koen Bok wrote:
>
>
>
>
>
> > Hey All,
>
> > I was upgrading our app from 0.4.1 to 0.4.5 and this code broke:
>
> > pg
Hey All,
I was upgrading our app from 0.4.1 to 0.4.5 and this code broke:
pg_user = Table('pg_user', metadata,
Column('usesysid', Integer, primary_key=True),
Column('usename', Unicode(), unique=True))
pg_group = Table('pg_group', metadata,
Column('grosysid', Integer, pri
Hey Mike,
We (Sofa) just sponsored a year 512 hosting. Check the paypal. And
keep up the good work!
Koen Bok
- madebysofa.com
On Mar 24, 8:39 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> another theory is that I had some vhost config that wasn't synced up
> on both DNS s
something to say for pythonizing triggers so they become
database agnostic, but I am not even sure if that is possible given
all the different triggers different databases can have.
What do you mean by 'unstable internals' in SQLAlchemy?
Kindest regards,
Koen Bok
On Jan 28, 12:03
g a composite is likely cleaner
> > and would integrate with the "save" process better (otherwise, the
> > callable needs to generate the "discriminator" value at save time as
> > well).
>
> > On Dec 3, 2007, at 11:09 AM, Koen Bok wrote:
>
>
I'd like to make a polymorphic mapper based on two columns. Is that
possible?
See example code here: http://paste.pocoo.org/show/13799/
Thanks, Koen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group
think it does as my tests pass fine.
You just earned yourself another sushi meal ;-)
Koen
On Dec 1, 8:40 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Dec 1, 2007, at 9:33 AM, Koen Bok wrote:
>
>
>
> > This is quite hackish, but just an experiment for me.
>
> &
This is quite hackish, but just an experiment for me.
We use listen/notify in our app. A seperate thread is listening for
notifications from updated rows in the table. If one is received I'd
like to expire an object in the Session cache so it gets refetched the
next time it is accessed. I have it
Hi, I am trying to store numeric values for an object inverted in the
database. For that I created a custom TypeDecorator. It work's fine.
But I only want to apply it to one inherited object type for that
object. See example code at: http://paste.pocoo.org/show/12411/
Thanks, Koen
--~--~-
Aight, thanks for the explanation!
Koen
On Nov 20, 5:02 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Nov 20, 2007, at 6:19 AM, Koen Bok wrote:
>
>
>
> > I have some questions about pickling/merging objects.
>
> > I have written example code to demonstr
I have some questions about pickling/merging objects.
I have written example code to demonstrate: http://pastie.caboo.se/120146
Kindest regards,
Koen Bok
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlal
Thanks Mike. Cool stuff!
On Nov 19, 1:26 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> Hello alchemers -
>
> This is an awesome release. I'm excited about this one. With our new
> shiny clean 0.4 codebase, internals are starting to look a lot more
> intelligent, and new things are becoming
Ok, I could do that.
On Nov 15, 4:09 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Nov 15, 2007, at 9:06 AM, Koen Bok wrote:
>
>
>
> > Hi,
>
> > I use scoped_session in our project for auto object saving which is
> > great. But when I initial
Hi,
I use scoped_session in our project for auto object saving which is
great. But when I initialize a new database I need to flush some
objects with another engine. I could not find a nice way to do that so
I created a new session with it's own engine and merged the objects
into that one and cle
Yep. That was it. Stupid me...
On Nov 13, 4:10 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Nov 13, 2007, at 8:25 AM, Koen Bok wrote:
>
> > Hi, I have this strange bug or problem...
>
> > I have a basic class like this mapped to a table with the same name.
> &
Hi, I have this strange bug or problem...
I have a basic class like this mapped to a table with the same name.
Metatype is a relation to the metatype object.
class MetaData(DBObject):
def __init__(self, metatype, value, item):
self.metatype = metatype
se
Hi there,
We have a pretty large project by now and we run into import loops. So
I decided to restructure the code, and I hoped some people with more
experience can comment on this.
The basic problem is this:
We have the database object code, mappers and tables neatly organized
in one module (d
Hi, I am doing some optimizations on our app, and one thing I was
wondering is if I can have a lazy relation loading in a separate
thread.
The way I'd like to use it is like this. I have a list with products,
and these products show a graph with stock levels. To draw this graph,
the object fetche
I have no info on this, but I have seen the current owner on this and
the migrate group.
It would be awesome if migrate would work again.
Koen
On Sep 9, 2:53 pm, Jan Dittberner <[EMAIL PROTECTED]>
wrote:
> I read the discussion regarding the status of the migrate tool and
> would like to help w
> From: sqlalchemy@googlegroups.com
> > [mailto:[EMAIL PROTECTED] On Behalf Of Koen Bok
> > Sent: Saturday, September 08, 2007 6:17 PM
> > To: sqlalchemy
> > Subject: [sqlalchemy] Get Table/Column Sequence Names
>
> > For sqlalchemy auto generated sequences
For sqlalchemy auto generated sequences (postgres) is there a nice way
to find out:
- If a table/column has any
- If so, what are the names
Thanks! Koen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy"
> On Sep 6, 2007, at 10:28 AM, Koen Bok wrote:
>
>
>
> > Aight, that would be cool. So this still has to be implemented then,
> > right?
>
> embedded select works eh ? try making your default that:
>
> default=select([func.max(metanumber.id)])
--~--~-~-
uld look like this:
>
> Column('foo', Integer, ColumnDefault(func.coalesce(func.max
> (metanumber_table.c.id), 0), inline=False))
>
> so that it gets the hint to "pre-execute" that default.
>
> On Sep 6, 2007, at 8:44 AM, Koen Bok wrote:
>
>
>
> &
Hi there, I am upgrading my app to 0.4 and while it's going pretty
well, I encountered something strange.
I have the following code:
request_table = Table('request', metadata,
Column('id', Integer, primary_key=True),
...
Column('metanumberstate', Integer, nullable=False,
My app saves bookmarks to different Postgres servers, and tries to
connect at login. But if the server from the bookmark is not reachable
or down, it only times out after like 2 minutes. So I could either
check if the host is available before connecting (telnetlib connection
to the Postgres port)
Dear Gennady,
I'm afraid flushing is your only option, as you need the next number
from the database sequence. What I do is flushing some objects in
their init methods already.
Kindest regards,
Koen Bok
On Aug 19, 7:22 am, Gennady <[EMAIL PROTECTED]> wrote:
> Hello,
>
>
For our app we'd like the user to construct and save search queries
that we execute on the database. My first thought was to construct
something like:
predicate = and_(or_(item.c.id>5, item.c.id<3),
item.c.name.like('aap')))
And save this to a pickle column in the database. But it gives:
raise
; ('offset')], and_(
> f1.c.id_product==bindparam('f1item'),
> bindparam('something') <= subquery
> ) , order_by=[desc(f1.c.id)], limit = 1
> )
>
> print s
>
> I think in 0.4 im going to deprecate "scalar=True&
I need to do a cumulative select on postgres, and I got it to work
with some extreme SQL query, but I was wondering if it could be done
more easily without having to drop to SQL but with SQLAlchemy
statements.
Let's say I have a table with stock transactions like this:
Transaction
id
on.query(Item).order_by(desc
> (item_table.c.name)).all()
>
> koen.collections.append(dirk)
> assert dirk in koen.collections
> assert koen in dirk.items
> session.flush()
> session.clear()
>
> (koen, dirk) = session.query(Item).order_by(desc
> (item_table.c.name)).all()
> assert dirk i
s=relation(Item, secondary=collection_table ,lazy=True,
backref='items')))
metadata.create_all()
session = create_session()
session.save(Item('Koen Bok'))
session.save(Item('Dirk Stoop'))
session.flush()
# And now we should be able to do so
And you were right. It turned out to be a stupid idea anyway. Let that
be a lesson for the next programmer who tries to be lazy ;-)
On Jul 7, 12:32 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Jul 6, 2007, at 5:50 PM, Koen Bok wrote:
>
>
>
> > I have a strange situat
I have a strange situation. If someone _really_ needs to know why I
could explain.
When an object gets deleted by SQLAlchemy, it's related objects are
getting updated setting their foreign keys referring to the deleted
items to NULL. But what if I don't want that to happen? Viewonly is
not an opt
Yep that's it.
If anyone has the same just do this:
engine.execute('BEGIN;GRANT SELECT ON TABLE checkout_info TO
testuser;COMMIT;')
Ciao
Koen
On Apr 29, 4:51 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Apr 29, 2007, at 9:28 AM, Koen Bok wrote:
>
>
>
And ofcourse the first result should be this in the above mail:
> Test=# \z testtable
>Access privileges for database "Test"
> Schema | Name | Type | Access privileges
> +---+---+
> public | testtable | table | {koen=arwdxt/koen}
> (1 ro
I want to grant permissions through sqlalchemy, but for some reason if
I let an engine execute the sql it does not work:
Code:
from sqlalchemy import *
engine = create_engine('postgres://localhost/Test')
engine.echo = True
engine.execute('CREATE USER testuser;')
engine.execute('GRANT SELECT ON
That would be very nice. You have my vote.
Koen
On Apr 29, 5:13 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Apr 28, 2007, at 10:34 AM, Koen Bok wrote:
>
>
>
> > Is there a nice way to get the URL from a given engine?
>
> not at the moment...the url goes i
Is there a nice way to get the URL from a given engine?
Thanks,
Koen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscr
I am trying to catch username password errors to show in the
interface. But somehow I cannot catch the exeption. I wrap everything
in a try except, but the exeption is still throwed and my app stops
functioning. What am I doing wrong?
Koen
loginInfo = (
se
I wondered if it was possible to manage users inside postgres with the
help of SQLAlchemy. But I guess Postgres users are special objects and
not just rows in a table. I tried to do this, but it did not work.
from sqlalchemy import *
metadata = BoundMetaData('postgres://127.0.0.1/template1')
pg
Yep, and I want to know them after the flush :-)
On Apr 15, 7:11 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> session has a "deleted" accessor with all items marked as deleted.
> (its cleared out on flush()).
>
> On Apr 15, 2007, at 11:20 AM, Koen Bok wrote:
>
Is there a nice way to find out if an object has been deleted?
Ofcourse I could set a deleted = False on every mapped object and
subclass sqlalchemy's session object to set it to true when a delete()
is called on an object. But isn't there a less complicated way?
Koen
--~--~-~--~~--
work well. But is this a good way to do this or can it
cause complications?
On Apr 13, 11:23 am, "Koen Bok" <[EMAIL PROTECTED]> wrote:
> Ok, I'd rather handle it on the database level. Is that just a matter
> of creating a function and calling it on insert?
>
> Koen
Ok, I'd rather handle it on the database level. Is that just a matter
of creating a function and calling it on insert?
Koen
On Apr 13, 4:47 am, "Ants Aasma" <[EMAIL PROTECTED]> wrote:
> On Apr 13, 2:47 am, Jorge Godoy <[EMAIL PROTECTED]> wrote:
>
> > IF you insist on doing that at your code, mak
I need to have a uninterrupted number sequence in my table for
invoices. I was trying to do it like this, but I can't get it to work.
Can anyone give me a hint?
request_table = Table('request', metadata,
Column('id', Integer, primary_key=True),
Column('number', Integer, unique=Tru
I'm trying to wrap my head around the threadlocal plugin to decide if
we need it for our app. We are building a GUI point of sale system.
Until now I have done everything in sessions, basically in one global
shared session. I have read all of the documentation about the
threadlocal strategy but I
> the elegant way would be to not worry about the thread scope of a
> connection and just use connection pooling normally. pull out a
> connection when needed, close it when complete (which is really just
> a return to the connection pool). keep the scope of those two
> operations local
We are building a GUI app, and we were thinking about wrapping
session.flush() in a thread with a timer that detects a timeout. That
way we would have better performace and we can generate warnings if
the connection goes down. Do you guys think this is smart, or are
there complications?
I tried t
I posted a PDF of the documentation here in case someone needs it.
Koen
On Mar 29, 11:53 am, "Jonathan Ballet" <[EMAIL PROTECTED]> wrote:
> On 29 mar, 11:24, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote:
>
> > I can't reachwww.sqlalchemy.org, anyone else having problems?
>
> > Arnar
>
> Same here
Ok, thanks!
On Mar 26, 4:26 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> no. do a clear_mappers() and build your mappers again if you need to
> change the base configuration.
>
> On Mar 25, 2007, at 3:35 PM, Koen Bok wrote:
>
>
>
> > I get this, but that
Thanks! That did the trick!
On Mar 26, 4:33 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Mar 25, 2007, at 6:17 PM, Koen Bok wrote:
>
> > stock_request = select(
> >[stock_request_join] + \
> >[stock_table.c.quantity.op('-')
> > (func.s
Hello again!
I need a mapper that does an outer join on another table.
stock_request_join = sql.outerjoin(request_table, stock_table, and_(
request_table.c.id_item==stock_table.c.id_product,
request_table.c.id_location==stock_table.c.id_location,
r
ectrelations_options
>
> On Mar 25, 2007, at 6:50 AM, Koen Bok wrote:
>
>
>
> > Is it possible to change the lazy property of a primary mapper of an
> > object's relation on the fly so from then on it wil change the eager
> > loading of that relation.
>
&
Is it possible to change the lazy property of a primary mapper of an
object's relation on the fly so from then on it wil change the eager
loading of that relation.
I want to use this for a small debug window in my app where I can
change these on the fly to test which settings are optimal for the
I have a mapper like this:
mapper(Request, request_table, properties={
[SOME MORE STUFF]
'stock': relation(Stock, lazy=True, uselist=False,
primaryjoin=and_(
request_table.c.id_item==stock_request.c.id_product,
requ
Yeah, I am sure the tree will never be deeper than 3 or 4 levels.
Koen
On Mar 23, 5:24 pm, Andreas Jung <[EMAIL PROTECTED]> wrote:
> --On 23. März 2007 16:14:26 +0000 Koen Bok <[EMAIL PROTECTED]> wrote:
>
>
>
> > Could anyone please explain me a little why self ref
Could anyone please explain me a little why self referantial mappers
cannot be eager-loading. Is this not yet integrated in SQLAlchemy or
theoratically impossible or impractical?
Ciao
Koen
--~--~-~--~~~---~--~~
You received this message because you are subscribe
t; I wonder if this should be added to the FAQ?
>
> > Hope that helps,
>
> > Simon
>
> > -----Original Message-
> > From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED]
> > On Behalf Of Koen Bok
> > Sent: 22 March 2007 10:47
> > To: sqla
le.c.id==stock_table.c.id_location),
'stocktype': relation(StockType)})
If you need more, just let me know!
Koen
On Mar 22, 11:42 am, "Koen Bok" <[EMAIL PROTECTED]> wrote:
> Thanks for the reply! If the performance is about equal, that's fine!
>
ts.
>
> the queries it generates, i.e. select * from (select * from ...))
> will be optimized by the database's optimizer in most cases and
> should not add any overhead to your application.
>
> On Mar 21, 2007, at 8:08 PM, Koen Bok wrote:
>
>
>
> > My m
My mapper looks like this:
stock_unreserved = select(
[stock_table] + \
[stock_table.c.quantity.op('-')
(func.sum(request_table.c.quantity)).label('unordered')] + \
[stock_table.c.quantity.op('-')
(func.sum(request_table.c.allocation)).label('unallocated')],
and_(
Dear all.
I have to make a complicated mapper, and I need a little help.
We have a list of products. These products have stock, each individual
stock item has an entry in the stockproduct table. So to get the total
stock we need to count the items in the stock database. We can filter
them by a p
70 matches
Mail list logo