Re: [sqlalchemy] Re: question about `association_proxy` interface

2018-10-03 Thread Jonathan Vanasco
On Wednesday, October 3, 2018 at 9:40:37 AM UTC-4, Mike Bayer wrote: > > > those are not going to change within 1.2 or 1.3 but it's not ideal to > be relying on them. For query._entities, you can use the public > accessor query.column_descriptions. for _with_options I'm not sure > what it

Re: [sqlalchemy] Re: question about `association_proxy` interface

2018-10-03 Thread Mike Bayer
On Tue, Oct 2, 2018 at 4:44 PM Jonathan Vanasco wrote: > > And a quick followup to Michael: > > I didn't want to pollute the comments in > https://bitbucket.org/zzzeek/sqlalchemy/issues/3225/query-heuristic-inspection-system > as there may not have been any substantial changes and I'm just

[sqlalchemy] Re: question about `association_proxy` interface

2018-10-02 Thread Jonathan Vanasco
And a quick followup to Michael: I didn't want to pollute the comments in https://bitbucket.org/zzzeek/sqlalchemy/issues/3225/query-heuristic-inspection-system as there may not have been any substantial changes and I'm just reviewing my old notes wrong... How long do you think it is safe to

[sqlalchemy] Re: Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Carson Ip
Sorry for the messed up word wrap. I find this Google Groups web editor hard to use. On Wednesday, August 22, 2018 at 6:03:07 PM UTC+8, Carson Ip wrote: > > This is my first post here. > > Software / Library versions: (tho unrelated) > sqlalchemy version: 1.0.19 > db: MySQL 5.6 > db driver:

Re: [sqlalchemy] Re: Question about collection_class=ordering_list and Bullet.slide = slide

2016-09-23 Thread HP3
Thank you very much Mike! The behavior I am getting is very strange. The test case (I posted and then removed by accident) validates the behavior of "append to list". IOW: position is correct and not None. 105 def test_backref_set(self): 106 self._setup(ordering_list('position'))

Re: [sqlalchemy] Re: Question about collection_class=ordering_list and Bullet.slide = slide

2016-09-23 Thread Mike Bayer
The mechanism of backrefs is such that when you assign to the many-to-one side of the relationship, if the one-to-many is not loaded from the database, the "append" that you want to do does not occur at that time. When the list is not loaded, the object is placed in a queue where it will be

[sqlalchemy] Re: Question about collection_class=ordering_list and Bullet.slide = slide

2016-09-23 Thread HP3
There seems to be something else ... The following test passes which indicates that position is set as 0 right after the bullet and the slide are related: 93 def test_backref_set(self): 94 self._setup(ordering_list('position')) 95 96 #session = create_session() 97

[sqlalchemy] Re: Question about collection_class=ordering_list and Bullet.slide = slide

2016-09-23 Thread HP3
> > The test below (test/ext/test_orderinglist.py) demonstrates the behavior: > 93 def test_backref_set(self): 94 self._setup(ordering_list('position', count_from=0, 95 reorder_on_append=True)) 96 97 s1 = Slide('Slide #1') 98

Re: [sqlalchemy] Re: Question about the other property of backref

2016-02-25 Thread Jonathan Vanasco
On Thursday, February 25, 2016 at 5:05:25 AM UTC-5, Simon King wrote: > I think it's a matter of personal preference. Some people like to see all > the attributes of a class defined as part of the class definition itself, > in which case they'll need to use 2 relationship definitions with

Re: [sqlalchemy] Re: Question about the other property of backref

2016-02-25 Thread 尤立宇
Thanks! This is exactly what I was looking for. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group,

Re: [sqlalchemy] Re: Question about the other property of backref

2016-02-25 Thread Simon King
On Thu, Feb 25, 2016 at 7:53 AM, 尤立宇 wrote: > Thanks for your response. > > Do you consider using `backref` only on one of the class bad practice? > > I'm curious because automatically creating descriptors seems possible to > me, and I'm wondering when it happens. > > As

[sqlalchemy] Re: Question about the other property of backref

2016-02-24 Thread 尤立宇
Thanks for your response. Do you consider using `backref` only on one of the class bad practice? I'm curious because automatically creating descriptors seems possible to me, and I'm wondering when it happens. As documentation states so: Remember, when the backref keyword is used on a single

[sqlalchemy] Re: Question about the other property of backref

2016-02-24 Thread Jonathan Vanasco
So in your example (simplified below) class User(Base): ... class Address(Base): ... user = relationship('User', backref='addresses') when you create `Address.user` the `backref` command automatically creates the "other" side of the relationship --

[sqlalchemy] Re: Question on session.expunge.all()

2011-09-08 Thread Victor Olex
Since you are effectively overwriting the table with new file contents, the fastest may well be to truncate the table then insert all contents. If you were to just append and update then session.merge() is convenient way to do this though I am not sure if the fastest. On Sep 7, 5:53 pm, Vlad K.

Re: [sqlalchemy] Re: Question on session.expunge.all()

2011-09-08 Thread Vlad K.
No, I can't truncate the table for other reasons, as I mentioned in my original question. :) The issue here was not how to sync the data, but whether processed rows stay in session even though the objects (model instances) are discarded at the end of each iteration (each csv row), or in

[sqlalchemy] Re: question about urls when creating engine

2010-05-13 Thread Faheem Mitha
On Thu, 13 May 2010 09:25:21 -0400, Michael Bayer mike...@zzzcomputing.com wrote: On May 13, 2010, at 7:33 AM, Faheem Mitha wrote: Hi, In http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines it describes how permitted urls are of the form

[sqlalchemy] Re: Question about joins and how the data is returned by the Query class

2009-07-14 Thread Michael Bayer
The Devil's Programmer wrote: So what I am trying to figure out, is if there is a way to have the query return None in place of the missing UserVote when the user is not logged in? I'm hoping there might be some kind of .join_placeholder(UserVote) method that I have somehow overlooked, or

[sqlalchemy] Re: Question about joins and how the data is returned by the Query class

2009-07-14 Thread The Devil's Programmer
Thanks, works like a charm :) On Jul 15, 2:27 am, Michael Bayer mike...@zzzcomputing.com wrote: The Devil's Programmer wrote: So what I am trying to figure out, is if there is a way to have the query return None in place of the missing UserVote when the user is not logged in? I'm

[sqlalchemy] Re: question re query vs select

2009-01-04 Thread Michael Trier
Hi, On Sun, Jan 4, 2009 at 7:18 AM, robert rottermann rob...@redcor.ch wrote: hi there I have a class tblMembershiptypeTable which I defind using declarative notation whereas t = tblMembershiptypeTable.__table__ mt = session.execute(select(t, t.c.name == mtype)).fetchone() returns a

[sqlalchemy] Re: question/problem with relation and autoload

2008-12-30 Thread robert rottermann
found it out myself: related_persons = orm.relation(tblPersonTable, secondary=tblPersonCompanyTable, backref=company) must be related_persons = orm.relation(tblPersonTable, secondary=tblPersonCompanyTable.__table__, backref=company) have a good time robert robert

[sqlalchemy] Re: question regarding aliases in ORM, within an expression

2008-12-15 Thread Michael Bayer
On Dec 15, 2008, at 9:47 AM, Moshe C. wrote: Table T has a self referential parent_id column. 'parent' is an orm.relation using that column. I have the following code which obviously does not work myquery = T.query() myquery = myquery.outerjoin('parent', aliased=True) myquery =

[sqlalchemy] Re: Question about when to use connection pooling

2008-07-25 Thread Bram Avontuur
As I can see, the turbogears way of creating the session as I described above does not use a connection pool. First of all, am I right to assume this? The default way is to create a new connection to the database whenever a session object is instantiated this way? the Session usually

[sqlalchemy] Re: Question about when to use connection pooling

2008-07-25 Thread Michael Bayer
On Jul 25, 2008, at 8:23 AM, Bram Avontuur wrote: As I can see, the turbogears way of creating the session as I described above does not use a connection pool. First of all, am I right to assume this? The default way is to create a new connection to the database whenever a session object is

[sqlalchemy] Re: question

2008-07-18 Thread Michael Bayer
On Jul 18, 2008, at 10:07 AM, Vladimir Iliev wrote: hi, i have a method that returns list of (material, thickness) groups which looks like: C = [order_element_items.c.material_uuid, materials.c.name, order_element_items.c.thickness] S =

[sqlalchemy] Re: Question: mapping a complex SQL instruction as a relation

2008-01-31 Thread Stefano Bartaletti
Alle lunedì 28 gennaio 2008, Michael Bayer ha scritto: this example is the working version of what's in ticket #948. a few other combinations of the above are not yet working, namely if you tried using lazy=True, or if you put an explicit correlate(users) on the stuff_view selectable.

[sqlalchemy] Re: Question: mapping a complex SQL instruction as a relation

2008-01-28 Thread Michael Bayer
On Jan 28, 2008, at 12:03 PM, Stefano Bartaletti wrote: Hello, I have two tables defined this way: tabItems = sqa.Table(meta, items, sqa.Column(id, sqa.Integer, primary_key=True), ) tabTracking = sqa.Table(meta, tracking, sqa.Column(id, sqa.Integer,

[sqlalchemy] Re: Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
I forgot to mention, I am using SA 0.3.10. Thanks, Allen On Dec 7, 2007 7:49 AM, Allen Bierbaum [EMAIL PROTECTED] wrote: I am trying to create two queries with some of my SA ORM objects that will use the sum of a field found through a relationship. To be a bit more concrete, here is a

[sqlalchemy] Re: Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
Thanks for the feedback. I hadn't thought of doing it this way. I did comb through the documentation a 2nd and 3rd time today though and found the add_column() method for queries. It looks like that may be another way to get what I want. I am thinking about even creating a little builder

[sqlalchemy] Re: Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread jason kirtland
bob wrote: Hi, I am going over this this example to learn how to construct an eager- loaded adjacency tree, http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/byroot_tree.py and I noticed that some of the keys in the treenodes table are given long names in

[sqlalchemy] Re: Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread bob
Thanks for clearing that up! :) Bob --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to

[sqlalchemy] Re: question about unicode usage.

2007-10-17 Thread Michael Bayer
On Oct 17, 2007, at 7:41 PM, dykang wrote: query2 = sqlalchemy.select([test], sqlalchemy.and_ ( test.c.id == sqlalchemy.bindparam ('id'), test.c.name == sqlalchemy.bindparam('name'), ) ) currently you'd have to say test.c.name == bindparam('name',

[sqlalchemy] Re: Question about queries and operators

2007-08-09 Thread Michael Bayer
add_entity() by itself is not going to add a table to a count() function; the extra entities arent taken into account by count(). Looking at the query you have below, i.e. the one which works, im a little puzzled. you aren't associating the geo_route and geo_location tables together

[sqlalchemy] Re: Question about queries and operators

2007-08-09 Thread mattrussell
Hi Michael, I've sorted this one now :) I'm sorry for the amigious nature of my post... wasn't clear in my head at the time. You are right, I wasn't associating between the two entities in the example I gave. I ended up using sqlalchemy.sql._BinaryExpresssion in my subclass, which enabled the

[sqlalchemy] Re: Question about queries and operators

2007-08-09 Thread Michael Bayer
hey matt - you might also look at a new feature we have in 0.4 called composite column types, this is an ORM-only feature whereby you can provide column-behavior on a plugin basis and also use multiple columns to represent a single scalar unit:

[sqlalchemy] Re: Question about overriding properties

2007-04-26 Thread Michael Bayer
On Apr 26, 2007, at 11:37 AM, Barry Hart wrote: In our application's Order table, we have foreign-key fields which reference the persons who placed the order, are responsible for fulfilling the order, etc. For reporting speed, the Order table holds denormalized copies of contact