Excellent. As always, thanks very much for your time and answers (let
alone awesome software)!
On Wed, Jan 27, 2021 at 1:25 PM Mike Bayer wrote:
>
>
> On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote:
>
> Thanks a ton for your responses.
>
> Do all the normal column
uld that modify the compiled mappers for the entire
process... these are the things running through my head.)
On Tue, Jan 26, 2021 at 8:18 PM Mike Bayer wrote:
>
>
> On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote:
>
> I should have given these details from the get
I should have given these details from the get-go: the use case is a
specialized select() (dynamically built) which would be extremely
convenient to map relationships against for convenience in subquery
loading, etc. So, the class would not already have a mapper. Can I pass
non_primary=True
ore
> warnings or conditions like this. the most important part is getting the
> test coverage in so as I refactor for 1.4 / 2.0 the behavioral contract is
> maintained. thanks!
>
>
>
> On Wed, May 13, 2020, at 1:16 PM, Kent Bower wrote:
>
> Very good, will do when I find tim
ts
> screwed up, the pool will warn and still make sure it does a real
> rollback.you should not see this warning however.
>
> in 2.0, the whole "reset" logic is simplified so that none of this
> complexity will be there.
>
>
>
> On Wed, May 13, 2020, at 11:5
elease today
>
>
>
> On Wed, May 13, 2020, at 11:51 AM, Mike Bayer wrote:
>
>
>
> On Wed, May 13, 2020, at 11:39 AM, Kent Bower wrote:
>
> In this script, conn.close() does *not *call rollback on the
> transaction. It isn't just a logging issue as I've verified from the
&g
In this script, conn.close() does *not *call rollback on the transaction.
It isn't just a logging issue as I've verified from the database that the
session was not rolled back.
On Wed, May 13, 2020 at 11:31 AM Mike Bayer
wrote:
> Haven't looked deeply but so far what you need to know is that
>
Thanks very much!
On Wed, May 10, 2017 at 2:24 PM, mike bayer
wrote:
> this is all patched in 1.2, your original test works too.
>
> The fix here is a little too intricate for 1.1 right now as this is a very
> long-standing bug(goes back to 0.7 at least and
If never present in __dict__, why does it need to be marked as expired
after an insert or update? If not in __dict__ and referenced, isn't won't
it load as whether or not it is marked as expired?
On Wed, May 10, 2017 at 1:48 PM, mike bayer
wrote:
> nevermind, the
The regular columns seem to expire and reload properly without issue. (Is
that what you're asking?)
You want me to submit a PR changing:
if p.expire_on_flush or p.key *not *in state.dict
to
if p.expire_on_flush *and *p.key in state.dict
?
On Wed, May 10, 2017 at 12:55 PM, mike bayer
The load() event would also capture if it were subqueryload()ed, right?
And overriding Query.__iter__ wouldn't catch the cases where the scalar is
a "use_get" lookup that was already in session.identity_map... No good way
to intercept attributes.set_committed() for that, is there?
On Fri, Oct
I attempted to search for such an enhancement but obviously failed to find
it. Patching the changeset in was fairly straightforward.
Thanks very much Jonathan and Mike!!
On Wed, Aug 17, 2016 at 5:41 PM, Mike Bayer
wrote:
>
>
> On 08/17/2016 01:25 PM, Kent wrote:
>
Thanks Mike.
I'm not sure FunctionElement is most appropriate or if Interval() is the
best "type," but for future readers, as a recipe, this seems to work:
class seconds_interval(FunctionElement):
type = Interval()
name = 'seconds'
def __init__(self, *args, **kwargs):
Yeah, it seems to me that if you pass a *specific connection* to a
sessionmaker for some (whatever) reason, that sessionmaker shouldn't ever
silently take a different one.
I'll need to work on detecting or sabotaging new connections from a
sessionmaker which was passed a specific connection. (I
ah either don't
> call that , or set up the connection immediately on the next session.
>
> On Wednesday, April 13, 2016, Kent Bower <k...@bowermail.net
> <javascript:_e(%7B%7D,'cvml','k...@bowermail.net');>> wrote:
>
>> About a year ago you helped me ensure my
About a year ago you helped me ensure my scoped session gets the same
connection to the database, which might be important.
I found out using "bind=connection" doesn't guarantee the session_maker
uses that connection if something went wrong with the session and
ScopedSession.remove() was called.
That makes sense,
Thanks,
Kent
On Mar 7, 2013, at 12:09 PM, Michael Bayer mike...@zzzcomputing.com wrote:
The hybrid attribute is a Python function that invokes when it's called. So
it doesn't make sense for it to be a column property since there is no
attribute to be populated.
Thank you!
On 6/5/2012 4:41 PM, Michael Bayer wrote:
On Jun 5, 2012, at 4:21 PM, Kent wrote:
I am subquery loading some related properties for a polymorphic
inheritance use case similar to the script attached. SQLA seems to
be issuing several extra queries that I didn't expect and don't
Thanks for pointing me there. As an aside, the recipe would be more
bulletproof if it specified the columns (order). Currently, it assumes
sqlalchemy knows the order of the columns in the database, which it may not.
Thanks again!
On 3/30/2012 6:40 PM, Michael Bayer wrote:
its not built in
')) or
something like that. Maybe people have suggestions.
On Mar 30, 2012, at 6:43 PM, Kent Bower wrote:
Thanks for pointing me there. As an aside, the recipe would be more
bulletproof if it specified the columns (order). Currently, it
assumes sqlalchemy knows the order of the columns in the database
That will work for me, thanks!
P.S. make a note that the doc statement that it will be a future release
should be updated.
On 3/21/2012 10:04 AM, Michael Bayer wrote:
also polymorphic_on can be any SQL expression in 0.7, like a CASE statement if
you wanted.
--
You received this message
I hadn't really thought the save-update through, my real interest was
regarding merge. For save-update it may not make as much sense.
On 2/29/2012 10:55 AM, Michael Bayer wrote:
I get what that would do for merge and might not be a big deal, what
would it do for save-update?
Sent from my
Somewhere between 0.6.4 and 0.7.5, the expunge cascade behavior
changed. Can you help me understand what changed/point me to the
ticket? The attached script assertions succeed in 0.6.4 but the last
one fails in 0.7.5. It doesn't seem wrong, but I'm wondering what the
behavior was defined as
I think I understand why, during a flush(), if I use
session.query().get() for an item that was just added during this flush,
I don't get the persistent object I might expect because the session
still has it as pending even though, logically, it is already persistent.
I don't suppose you have
Yeah, just the two cresultproxy.so and cprocessors.so, right?
On 1/12/2012 3:34 PM, Michael Bayer wrote:
when you do the setup.py the log messages say so.
Otherwise you'd look where sqlalchemy was installed and check if you see .so
files.
On Jan 12, 2012, at 12:35 PM, Kent wrote:
What is
funny story, here's where it was added:
http://www.sqlalchemy.org/trac/ticket/1910 which is essentially your ticket !
:)
I just double checked and I had patched in rfde41d0e9f70
http://www.sqlalchemy.org/trac/changeset/fde41d0e9f70/. Is there
another commit that went against 1910? For
Thank you very much!
On 1/10/2012 11:47 AM, Michael Bayer wrote:
Code wasn't covered and is a regresssion, fixed in rd6e321dc120d.
On Jan 10, 2012, at 10:58 AM, Kent wrote:
Mike,
Old code:
==
def visit_bindparam(bindparam):
On 1/9/2012 2:33 PM, Michael Bayer wrote:
On Jan 9, 2012, at 2:30 PM, Kent wrote:
i guess the patch is interacting with that load_on_pending stuff, which I probably
added for you also. It would be nice to really work up a new SQLAlchemy feature:
detached/transientobject loading document
On 1/9/2012 5:33 PM, Michael Bayer wrote:
On Jan 9, 2012, at 2:36 PM, Kent Bower wrote:
that means some of the columns being linked to the foreign keys on the target are None.
If you want your lazyload to work all the attributes need to be populated. If you're
hitting the get committed
Right. And reconstruct_instance() was renamed load()?
On 12/24/2011 5:56 PM, Michael Bayer wrote:
On Dec 24, 2011, at 10:04 AM, Kent wrote:
As the migration guide suggests, I'd like to embrace the events API.
Is mapper event load() invoked at exactly the same place as the
deprecated
So, what would you suggest the right answer is in this case? In the
real world scenario we have a potentially good reason to avoid the
association proxy approach since that involves an additional table which
may be unneeded.
Is the best answer just to provide the foreign keys as I did?
On
If I intercept strings that are empty and replace with None, is there
potential problems because the database record and the python object are
out of sync? Thereafter, will sqla believe the column value has
changed and try to write again on next flush()?
On 11/4/2010 11:42 AM, Michael
is None you get False. But
if you expire the attribute and then ask again you get True.
On 11/4/2010 5:07 PM, Michael Bayer wrote:
On Nov 4, 2010, at 4:06 PM, Kent Bower wrote:
If I intercept strings that are empty and replace with None, is there potential problems
because the database record
P.S. Thanks again very much
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options,
to make that change...,
but let me know.
On 9/8/2010 3:34 PM, Kent Bower wrote:
I've got a recipe for what will work well for us. I imagine it could
be useful for others, although I left out the actual serialization
mechanism, since that will likely be very project specific.
I'd be happy
I've got a fix for our project. Python is really cool about letting
you reassign methods and functions, so I just reassigned
CollectionAttributeImpl._set_iterable to my own function.
The point is, for my sake, don't worry about a public API, unless others
also ask about it...
Thanks for
on it. I just know that as default behavior, or even readily
switchable behavior, non-invested users get confused rather quickly.
On Sep 10, 2010, at 4:21 PM, Kent Bower wrote:
I've got a fix for our project. Python is really cool about letting you
reassign methods and functions, so I just
)
On 9/8/2010 1:27 PM, Michael Bayer wrote:
On Sep 8, 2010, at 1:15 PM, Kent Bower wrote:
I imagine you are already aware of this...
Unfortunately, the clause comparison says these two clauses are
different:
(Pdb) print self
locations.siteid = :param_1 AND locations.locationid = :param_2
than welcome (I'd prefer your feedback). If you are
busy, I can just post it and hope someone may find it useful.
Thank again for your help,
Kent
On 9/7/2010 7:28 PM, Michael Bayer wrote:
On Sep 7, 2010, at 6:41 PM, Kent Bower wrote:
Two items:
* How does the orm currently determine whether
Mike, in your proof of concept, when __getstate__ detected transient,
why did you need to make a copy of self.__dict__? self.__dict__.copy()
On 9/6/2010 2:35 PM, Michael Bayer wrote:
On Sep 6, 2010, at 2:11 PM, Kent Bower wrote:
Also, I was hoping you would tell me whether this would
/7/2010 10:25 AM, Michael Bayer wrote:
On Sep 7, 2010, at 10:12 AM, Kent Bower wrote:
Mike, in your proof of concept, when __getstate__ detected transient,
why did you need to make a copy of self.__dict__? self.__dict__.copy()
i was modifying the __dict__ from what would be expected in a
non
Fantastic, I will like to look into this change.
Since you asked, consider a use case similar to this: we have a RESTfulish web
service that accepts a serialized version of a transfer object which is
passed to the server when a database save should take place. In this case, an
order with
On Sep 6, 2010, at 1:04 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Sep 6, 2010, at 12:01 PM, Kent Bower wrote:
Fantastic, I will like to look into this change.
Since you asked, consider a use case similar to this: we have a RESTfulish
web service that accepts a serialized
or pickling it... the server is stateless.
Would that make a difference to your approach?
On 9/6/2010 2:35 PM, Michael Bayer wrote:
On Sep 6, 2010, at 2:11 PM, Kent Bower wrote:
Also, I was hoping you would tell me whether this would be a candidate for
subclassing InstrumentedAttribute
Now, thank you for the quick reply.
I might not be understanding what you need here, but assuming you want
your API to look like this:
product.sales('2010-08-20')
[Sale,Sale, ...]
Right, that is the idea.
First of all, is that enough? If you just want to dynamically access
an
Ah. Then the problem is in turbogears (which creates a default .ini
file with):
#echo shouldn't be used together with the logging module.
sqlalchemy.echo = false
sqlalchemy.echo_pool = false
sqlalchemy.pool_recycle = 3600
...logging sections...
I did find a reference for oracle 8.0 that supports returning clause...
I've moved this to a ticket request in trac:
http://www.sqlalchemy.org/trac/ticket/1878
On 8/14/2010 11:14 AM, Kent Bower wrote:
Not a myth, I'm using them (via sqla). Simple views (just one table)
oracle figures out
Not a myth, I'm using them (via sqla). Simple views (just one table)
oracle figures out writes to all alone. For more complex views (joins
of tables), you can use an INSTEAD OF trigger to write to the view
(just pl/sql trigger where you tell Oracle what you want to happen when
someone
Excellent. The 'pass' ConcreteInheritedProperty.merge() method works fine.
Thanks again.
On 8/1/2010 2:24 PM, Michael Bayer wrote:
On Jul 31, 2010, at 7:41 AM, Kent wrote:
When I call merge() on an ArTran object, the merge() method of a
ConcreteInheritedProperty 'artransarchiveid'
that
No, in fact, there is no ArTranBase table at all.
If I remove concrete inheritance, how do I issue a UNION of the two
tables and have the objects polymorphically loaded?
On 7/29/2010 4:18 PM, Michael Bayer wrote:
On Jul 29, 2010, at 2:31 PM, Kent wrote:
I'm getting a messy error that
Right. I understand. Thanks for pointing that out, you are correct.
My bigger concern was getting the ArTranBase mapper correct. Apparently
there is no need in this case to specify with_polymorphic= in the
mapper. Did I miss documentation on using 'polymorphic_union' without
Nice. That might come in very useful, thanks.
However, I can't quite get the second approach to work:
exq=DBSession.query(Inventory).join(Location).filter(Location.siteid=='03').correlate(Product).subquery()
DBSession.query(Product).filter(exists(exq)).all()
Traceback (most recent call last):
On 5/30/2010 1:24 PM, Michael Bayer wrote:
On May 28, 2010, at 1:46 PM, Kent Bower wrote:
On 5/28/2010 10:08 AM, Michael Bayer wrote:
Is the pattern that you want to keep re-issuing a savepoint repeatedly using
the same name ? Does that have some different usage of resources versus
On 5/31/2010 9:55 AM, Michael Bayer wrote:
On May 31, 2010, at 8:24 AM, Kent Bower wrote:
Although sqla doesn't allow the user to specify the savepoint name, the same
could be accomplished given if support for the following were implemented:
Let me ask:
sp_a=begin_nested
* Is there a way besides session.commit() to free the savepoint
resource? Is there a way to provide the savepoint name, so I can use
the same name over? Lastly, if you aren't the expert, where would you
point me, zope group or TG group?
you could issue the SAVEPOINT instructions
From a quick reading of the 'transaction' package source, it looks like
you should be able to create savepoints and roll them back something
like this:
savepoint = transaction.savepoint()
try:
# ...
except:
savepoint.rollback()
raise
Thanks for the interest in helping. I
On 5/28/2010 10:08 AM, Michael Bayer wrote:
Is the pattern that you want to keep re-issuing a savepoint repeatedly
using the same name ? Does that have some different usage of resources
versus issuing/closing distinct savepoints with different names ?
As an aside, since oracle apparently has
Thank you, as always.
I failed to recognize I'm using the TurboGears foundation, which uses
zope transaction:
Is there a way to still accomplish this?
DBSession.begin_nested()
sqlalchemy.orm.session.SessionTransaction object at 0xe9d5150
DBSession.commit()
Traceback (most recent call
No, this is what was causing ORA-12704: character set mismatch:
SQL SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM
DUAL;
SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL
*
ERROR at line 1:
ORA-12704: character set mismatch
On
Thanks, that looks like its conceptually what we are hoping for, at least.
On 5/17/2010 3:58 PM, Tamás Bajusz wrote:
On Mon, May 17, 2010 at 9:49 PM, Kentk...@retailarchitects.com wrote:
Ideally, I agree. Practically speaking, though, we came from a
company where dozens and dozens of
http://www.sqlalchemy.org/trac/ticket/1797
On 5/11/2010 9:50 AM, Michael Bayer wrote:
just put up a new ticket, i dont really have time to attend to these right now.
you're right we'd probably move the partial pk's check to the ultimate call
that un-expires things.
On May 10, 2010, at
Just because there are configuration problems associated with adding a
feature like the one I needed is absolutely no reason to abandon it when
it can bring value to the tool if used correctly and in some
circumstances. I considered some of those exact complications what if
it was already
The following has changed since 0.5.8 in 0.6.0. I believe this is
already known or by design from reading docs and another post but want
to point out.
If you specify a column such as this:
Column(saleprice, Numeric, nullable=False)
you get a 'numeric' type in PostgreSQL, which supports
You think of everything? ;) Thanks
On 5/4/2010 2:41 PM, Michael Bayer wrote:
On May 4, 2010, at 2:30 PM, Kent wrote:
I understand I can disable RETURNING for an engine with
'implicit_returning=False'
Is there a way to do this for certain primary key columns only, but
not disabled
Note that this was ok in 0.5.8, so it must have been something related
to 0.6...
On 5/3/2010 12:04 PM, Michael Bayer wrote:
You can file a ticket for this but note that not everything is possible with
use_ansi=False. that mode of operation is somewhat miraculous that it even
exists. this
Thank you, sir.
On May 3, 2010, at 7:33 PM, Michael Bayer mike...@zzzcomputing.com
wrote:
OK the issue here is entirely un-subtle and its a little weird that
none of the tests we have hit upon it. this is fixed in tip.
On May 3, 2010, at 12:06 PM, Kent Bower wrote:
Note
May help others:
instead of col in const.columns
I needed col in list(const.columns)
to avoid: sqlalchemy.exc.ArgumentError: __contains__ requires a string
argument with the ColumnCollection object
On 4/30/2010 4:16 PM, Michael Bayer wrote:
Kent wrote:
I did read 0.6 Migration
Wait a second... ForeignKeyConstraint doesn't but PrimaryKeyConstraint
does?
(Not trying to be sassy, just wondering why I got the error in the first
place)
On 5/1/2010 2:11 PM, Michael Bayer wrote:
On May 1, 2010, at 2:04 PM, Kent Bower wrote:
May help others:
instead of col
Oh, I get it, you are saying ColumnCollection has contains_column()
method.
On 5/1/2010 4:05 PM, Kent Bower wrote:
Wait a second... ForeignKeyConstraint doesn't but
PrimaryKeyConstraint does?
(Not trying to be sassy, just wondering why I got the error in the
first place)
On 5/1/2010 2
):
=
On 5/1/2010 4:06 PM, Kent Bower wrote:
Oh, I get it, you are saying ColumnCollection has contains_column()
method.
On 5/1/2010 4:05 PM, Kent Bower wrote:
Wait a second... ForeignKeyConstraint doesn't but
PrimaryKeyConstraint does?
(Not trying to be sassy, just wondering why I got the error
it up in a separate session and then merge it into my main
session? Then, after that, merge the transient objects into my main
session? Would that get me closer? Ideally, I wouldn't want it to need
2 trips to the database.
On 4/29/2010 4:48 PM, Michael Bayer wrote:
Kent Bower wrote
On 4/30/2010 11:17 AM, Michael Bayer wrote:
Kent Bower wrote:
Could I look it up in a separate session and then merge it into my main
session? Then, after that, merge the transient objects into my main
session? Would that get me closer? Ideally, I wouldn't want it to need
2 trips
I'm exactly trying to avoid adding esoteric hacks - (why I posted in
the first place), so thanks for the information. I'll look into the
examples you've provided; I'm hopeful that the versioned objects have
in-tact relations (such that I could say old_object.orderdetails
and get that
It is helpful to know what SQLA was designed for.
Also, you may be interested to know of our project as we are apparently
stretching SQLA's use case/design. We are implementing a RESTful web
app (using TurboGears) on an already existent legacy database. Since
our webservice calls (and
Thanks very much.
On 4/2/2010 5:41 PM, Michael Bayer wrote:
Kent wrote:
Along the same lines, is there something we can do about nvl()
(oracle) versus coalesce() (ansi)?
They aren't exactly the same, unfortunately (nvl takes exactly 2
arguments, no more), so maybe there is nothing
As an aside, more recent Oracles support ansi coalesce,
so it is probably more appropriate to only use nvl() for older, non-ansi
Oracle versions, but if this is only for illustration then that is not a
big deal (unless you don't want people writing to you saying coalesce
does support more than
By the way,
Unless a ClauseList is subscriptable in 0.6, I had problems the way
it was.
Here is what I did:
@compiles(coalesce, 'oracle')
def compile(element, compiler, **kw):
sql = nvl(%s)
clauses = map(compiler.process, element.clauses)
for i in xrange(len(clauses) - 2):
Thanks for the info.
Still wondering, is there a way to tell the orm (a join criterion or a
binary expression) use this function to find the param for the bind?
On Apr 1, 2010, at 6:11 PM, Michael Bayer mike...@zzzcomputing.com
wrote:
Kent wrote:
I believe (correct me if you know
Thanks for the info.
Since it is NOCYCLE in oracle and NO CYCLE in postgres, I would check
the engine.dialect.name in the compile, method correct?
if eng.dialect.name == 'oracle':
sql += NOCYCLE
elif eng.dialect.name ==
Excellent. Thank for the example.
Questions:
1. I assume not, but want to ask: is there anything special about the
attribute '_cache' you've added to the session object? I could add
any such attribute?
2. Will this work fine with scoped sessions? (these objects aren't
recycled are
By the way, must get() always accept a primary key? For composite
keys is there a shortcut to access its ident (in the correct
order)? (So I could get the ident tuple and pass it to get() with
populate_existing())
On Mar 19, 2010, at 1:12 PM, Michael Bayer mike...@zzzcomputing.com
81 matches
Mail list logo