Hi, I'm trying to determine whether the url's database exists or not,
but didn't find any approach. I created a sqlite engine:
engine = create_engine('sqlite:///test.sqlite')
And tried to connect it:
engine.connect()
But it just created the database file if not existed. So is there any
way to
On Wed, 30 Apr 2008 03:34:16 -0700 (PDT)
Olli Wang [EMAIL PROTECTED] wrote:
Hi, I'm trying to determine whether the url's database exists or not,
but didn't find any approach. I created a sqlite engine:
engine = create_engine('sqlite:///test.sqlite')
And tried to connect it:
there's no generic way AFAIK.
u could switch on the dbtype part of dburl, and do different things
accordingly. see sqlalchemy/engine/url.py / make_url()
or see dbcook.usage.sa_engine_defs.py for similar approach:
http://dbcook.svn.sourceforge.net/viewvc/dbcook/trunk/dbcook/usage/
On Wednesday
-
replacing __init__(...) - i see that some effort is taken to keep the
original signature. But the result wont be debuggable IMO.
cant it be some_init(*a,**kw) doing whatever( *a,**kw) and/or calling
original_init(*a,**kw) ? whats inside is not changing as
sequence/logic anyway...
On Apr 29, 2008, at 5:55 PM, David Bonner wrote:
Hi, I'm trying to write a mapper extension that notifies a daemon
about changes made to the DB that it needs to care about. But it
looks like after_update() is actually getting called before the UPDATE
is sent to the db.
Not knowing a
On Apr 30, 2008, at 1:48 AM, kris wrote:
If I add a simple correlate feature to Query in 0.5, you can use
the
raw Table object to bypass the ORM meaning of Dataset and Base.
the query above is not quite complete but I can get an approximation
like this:
Is this functionality available
On Apr 30, 2008, at 8:50 AM, [EMAIL PROTECTED] wrote:
-
replacing __init__(...) - i see that some effort is taken to keep the
original signature. But the result wont be debuggable IMO.
cant it be some_init(*a,**kw) doing whatever( *a,**kw) and/or calling
original_init(*a,**kw) ?
then queried the db *directly using sql*. It looks like the change
hasn't made it to the DB yet
Also possible is that you're using a an MVCC DB such as Postgres or Oracle,
and you're looking at an old, pre-update version of the data, as your direct
SQL would be in a separate transaction
Michael Bayer wrote:
On Apr 30, 2008, at 8:50 AM, [EMAIL PROTECTED] wrote:
-
replacing __init__(...) - i see that some effort is taken to keep the
original signature. But the result wont be debuggable IMO.
cant it be some_init(*a,**kw) doing whatever( *a,**kw) and/or calling
On Wed, Apr 30, 2008 at 10:56 AM, Rick Morrison [EMAIL PROTECTED] wrote:
then queried the db directly using sql. It looks like the change
hasn't made it to the DB yet
Also possible is that you're using a an MVCC DB such as Postgres or Oracle,
and you're looking at an old, pre-update
On Wed, Apr 30, 2008 at 9:29 AM, Michael Bayer [EMAIL PROTECTED] wrote:
after_update() is called after all UPDATE statements have been issued
for that particular mapper. This includes *only* the table that is
mapped by that mapper, not any other mappers.
Is it possible that you are
I suppose that depends on the behavior of the DB-API interface, in this case
I guess that's psycopg.
Anyway, I'm certainly not sure if an MVCC snapshot that's causing your
problem, but it does seem like at least a possibility. The certain way is to
check the update status inside the same
On Apr 30, 2008, at 8:50 AM, [EMAIL PROTECTED] wrote:
should have one more argument iterator_func, and that to be passed
whatever the Visitor's .iterate is, instead of using hardcoded
fine. r4607:
def traverse_using(iterator, obj, visitors):
visit the given expression structure using
oops, uncommenting the pdb.set_trace(), obviously. sorry.
class MyExtension (MapperExtension) :
def after_update (self, mapper, connection, instance) :
#pdb.set_trace()
pprint.pprint(instance)
return EXT_CONTINUE
--
david bonner
[EMAIL PROTECTED]
On Apr 30, 2008, at 11:22 AM, David Bonner wrote:
When this code drops me into pdb, the data in instance.notes looks
like the new value, but querying the db in a separate process gets me
the old value.
flush() always uses a transaction, so when your pdb process hits, the
transaction has
On Wed, Apr 30, 2008 at 11:30 AM, Michael Bayer
[EMAIL PROTECTED] wrote:
flush() always uses a transaction, so when your pdb process hits, the
transaction has not been committed yet and results are not visible
outside of the transaction. the transactional keyword on Session
does not mean
Hello
I insert a new line in a table using this:
campfacility = Campfacility(prop1, prop2)
model.Session.save(campfacility)
model.Session.commit()
The campfacility id is handled by a postgres sequence.
What I'd like to do is:
campfacility = Campfacility(prop1, prop2)
seq =
On Wednesday 30 April 2008 18:25:25 Michael Bayer wrote:
On Apr 30, 2008, at 8:50 AM, [EMAIL PROTECTED] wrote:
should have one more argument iterator_func, and that to be
passed whatever the Visitor's .iterate is, instead of using
hardcoded
fine. r4607:
def traverse_using(iterator,
On Apr 30, 2008, at 12:15 PM, David Bonner wrote:
On Wed, Apr 30, 2008 at 11:30 AM, Michael Bayer
[EMAIL PROTECTED] wrote:
flush() always uses a transaction, so when your pdb process hits, the
transaction has not been committed yet and results are not visible
outside of the transaction.
On Apr 30, 2008, at 12:26 PM, [EMAIL PROTECTED] wrote:
On Wednesday 30 April 2008 18:25:25 Michael Bayer wrote:
On Apr 30, 2008, at 8:50 AM, [EMAIL PROTECTED] wrote:
should have one more argument iterator_func, and that to be
passed whatever the Visitor's .iterate is, instead of using
On Wed, Apr 30, 2008 at 2:50 PM, Michael Bayer [EMAIL PROTECTED] wrote:
if you want pre/post flush activities theres a SessionExtension which
hooks into Session for that. You can set it up with the
sessionmaker() function so that its always plugged in.
thanks, i'll look into that.
and
On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote:
thread 1 thread 2
execute(seq) - nextid = n
execute(seq) - nextid = n
model.Session.save(campfacility)
model.Session.save(campfacility) - BUG, nextid isn't correct
whats correct here,
i have some obj.pre_save() hook-method that is called just before
session.save_or_update( obj), to do last-point validations and/or
setup of timestamp-like fields.
There's an idea/ need to replace that with
mapper_extension.before_insert() but i'm not sure if these are
going to be
On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote:
thread 1 thread 2
execute(seq) - nextid = n
execute(seq) - nextid = n
On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote:
thread 1 thread 2
execute(seq) - nextid = n
execute(seq) - nextid = n
On Apr 30, 2008, at 3:23 PM, Eric Lemoine wrote:
Yes, the sequence is my table's PK. What I want to know is the PK
value of the line I'm going to insert (or I've just inserted). So I
guess this is indeed INSERT RETURNING.
if you pre-execute the sequence, the number you get back from it is
On Wed, Apr 30, 2008 at 9:23 PM, Eric Lemoine [EMAIL PROTECTED] wrote:
On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote:
thread 1 thread 2
Hi, I have two classes, Item and ItemId where one Item can have
multiple ItemIds accessible from its ref_ids relation.
I can do:
Item.query().filter(not_(Item.ref_ids.any(ref_id = OP-10-47000)))
if I want all the items except the ones with an ItemId with ref_id
set to OP-10-47000 and I can
On Wed, Apr 30, 2008 at 9:44 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Apr 30, 2008, at 3:23 PM, Eric Lemoine wrote:
Yes, the sequence is my table's PK. What I want to know is the PK
value of the line I'm going to insert (or I've just inserted). So I
guess this is indeed
On Apr 30, 2008, at 3:45 PM, Eric Lemoine wrote:
With psycopg2, I know people using this:
sql = INSERT INTO \%s\ (%s) VALUES (%s) % (self.table, columns,
values)
cursor = db.cursor()
cursor.execute(str(sql), values)
cursor.execute(SELECT currval('%s'); % sequence_name)
id =
fine. r4607:
def traverse_using(iterator, obj, visitors):
visit the given expression structure using the given
iterator of objects.
yeah, i how i get the ClauseVisitor to use that...
The idea was for the ClauseVisitor's traverse to use
ClauseVisitor's iterate (or _iterate),
On Apr 30, 2008, at 3:51 PM, Yannick Gingras wrote:
Hi, I have two classes, Item and ItemId where one Item can have
multiple ItemIds accessible from its ref_ids relation.
I can do:
Item.query().filter(not_(Item.ref_ids.any(ref_id = OP-10-47000)))
if I want all the items except the
On Apr 30, 2008, at 4:20 PM, Michael Bayer wrote:
Although, I think it may be wise here if SQLA set the correlate
value on the expression returned by any() to prevent these errors from
occuring at all. Below is a patch that does it. It needs a little
bit of tweaking to work with
I just started using session.merge, and I noticed that on session.flush(),
the before_update mapper extension for the objects that have been merged
into the session are not called.
These are new instances, not previously persisted.
Is there something I need to do to trigger this, or eesss a bug?
On Apr 30, 2008, at 10:47 PM, Rick Morrison wrote:
I just started using session.merge, and I noticed that on
session.flush(), the before_update mapper extension for the objects
that have been merged into the session are not called.
These are new instances, not previously persisted.
right, sorry, before_insert
On Wed, Apr 30, 2008 at 11:18 PM, Michael Bayer [EMAIL PROTECTED]
wrote:
On Apr 30, 2008, at 10:47 PM, Rick Morrison wrote:
I just started using session.merge, and I noticed that on
session.flush(), the before_update mapper extension for the objects
that
is not being called. as you call tell, I'm having trouble with the
keyboard tonight. first message was a typo,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email
37 matches
Mail list logo