[sqlalchemy] map several objects at once ?
Hi list, In my use case I have groups that can include other groups (many to many) groups can also include users (many to many) users can 'have feelings' to other users (many to many) What I want to achieve is : for a given group, recursively find its sub users for each of those users, I need the list of the users they ('like' | 'love' | 'hate' ... filter on this criteria) we discussed the recursive point here : http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg24742.html so I manage to have a query that when executed returns a list of all sub users (of class User) searched group is the starting point (Group object) content_q = searched_group.get_all_users() of course, I can iterate on the result of this query, and then create a dict of list (or whatever) all_users = set(content_q.all()) result = {} for user in all_users: result['user.id']=[] for other in user.my_feelings(feeling='love'): result['user.id'].append((other.id, other.name)) Still as all those tables join, I have a feeling this could be accomplished in a single query maybe not ? thanks for any idea NiL -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/3TrJBLp82toJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] joining to a from_statement
Hi, thank you for your help, and the effort at writing a good piece of code. however, while playing around with, and trying to execute it in PGAdmin, I stumbled upon some problems the q = Session().query(Group).join(all_parents, all_parents.c.id==Group.id) generates a SQL like (I've inserted real values): SELECT groups_recursive.id AS groups_recursive_id, groups_recursive.name AS groups_recursive_name, groups_recursive.display_name AS groups_recursive_display_name FROM groups_recursive JOIN (WITH RECURSIVE all_parents(id, rank) AS ( (SELECT groups_recursive.id AS id, 1 FROM groups_recursive_parents__groups_recursive_children WHERE groups_recursive.id = groups_recursive_parents__groups_recursive_children.parents_id AND groups_recursive_parents__groups_recursive_children.children_id = 4 UNION SELECT groups_recursive.id AS id, rank + 1 AS anon_2 FROM groups_recursive_parents__groups_recursive_children WHERE groups_recursive_parents__groups_recursive_children.children_id = id AND groups_recursive_parents__groups_recursive_children.parents_id = groups_recursive.id) ) SELECT * FROM all_parents) AS anon_1 ON anon_1.id = groups_recursive.id it chokes on : ERROR: invalid reference to FROM-clause entry for table groups_recursive LINE 3: (SELECT groups_recursive.id AS id, 1 ^ HINT: There is an entry for table groups_recursive, but it cannot be referenced from this part of the query. ** Error ** ERROR: invalid reference to FROM-clause entry for table groups_recursive SQL state: 42P01 Hint: There is an entry for table groups_recursive, but it cannot be referenced from this part of the query. Character: 242 obviously, there is a problem at the JOIN stage ... SELECT groups_recursive.id AS id, 1 FROM groups_recursive_parents__groups_recursive_children WHERE I tried s = select([groups.c.id, column(1)],from_obj=groups) to no better luck many thanks again NiL -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/4YkzRT9s2bAJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] joining to a from_statement
hi again, after playing a while with PG, here is a SQL statement that outputs the expected result SELECT groups_recursive.id AS groups_recursive_id, groups_recursive.name AS groups_recursive_name, groups_recursive.display_name AS groups_recursive_display_name FROM groups_recursive JOIN (WITH RECURSIVE all_parents(id, rank) AS ( SELECT groups_recursive.id AS groups_recursive_id, 1 FROM groups_recursive, groups_recursive_parents__groups_recursive_children WHERE groups_recursive_parents__groups_recursive_children.children_id = 4 AND groups_recursive_parents__groups_recursive_children.parents_id = groups_recursive.id UNION SELECT groups_recursive.id, rank+1 FROM all_parents, groups_recursive, groups_recursive_parents__groups_recursive_children WHERE groups_recursive_parents__groups_recursive_children.children_id = all_parents.id AND groups_recursive_parents__groups_recursive_children.parents_id = groups_recursive.id ) SELECT * FROM all_parents) AS anon_1 ON anon_1.id = groups_recursive.id; and FYI, here is what the code is issuing (not functionnal) SELECT groups_recursive.id AS groups_recursive_id FROM groups_recursive JOIN (WITH RECURSIVE all_parents(id, rank) AS ( (SELECT groups_recursive.id AS id, 1 FROM groups_recursive_parents__groups_recursive_children WHERE groups_recursive.id = groups_recursive_parents__groups_recursive_children.parents_id AND groups_recursive_parents__groups_recursive_children.children_id = :groupid UNION SELECT groups_recursive.id AS id, rank + :rank_1 AS anon_2 FROM groups_recursive_parents__groups_recursive_children WHERE groups_recursive_parents__groups_recursive_children.children_id = id AND groups_recursive_parents__groups_recursive_children.parents_id = groups_recursive.id) ) SELECT * FROM all_parents) AS anon_1 ON anon_1.id = groups_recursive.id we have problems such as column 1 does not exists if we add groups_recursive in both FROM clauses regards Nil -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/cTkUMo18h_IJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] joining to a from_statement
thank you so much Michael !! much better few last things are WITH RECURSIVE all_parents(id, rank) AS SELECT groups_recursive.id, 1 FROM groups_recursive, groups_recursive_parents__groups_recursive_children quotes around the 1, this leads to ERROR: column 1 does not exist + the param :rank_1 feels weird, it is generated by the rank + 1 in union( select([groups.c.id, rank + 1]).\ but it feels really close to the solution best NiL -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/Q0jzhkVnW6gJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Softcoding .filter(...)
say you want to filter on the 'field' (field would be a string representing the name of the field) on objects of class == Klass field_attr = getattr(Klass, field) would give you the instrumented attribute then Session.query(Klass).filter(field_attr == searchString) or Session.query(Klass).filter(field_attr.endswith(searchString)) would run HTH NiL -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/DWEguyVv4dIJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] joining to a from_statement
yes, many thanks I now have a method in my Group class (still in elixir syntax) def hierarchy_ng(self): with CommonTableExpression.create( all_parents, [id, rank]) as all_parents: rank = literal_column(rank) groups = Group.table groups_assoc = Group._descriptor.find_relationship('parents').table s = select([groups.c.id, literal_column(1)]).\ where(groups.c.id==groups_assoc.c.parents_id).\ where(groups_assoc.c.children_id==bindparam(groupid)).\ correlate(None).\ union( select([groups.c.id, rank + literal_column(1)]).\ where(groups_assoc.c.children_id== all_parents.c.id).\ where(groups_assoc.c.parents_id==groups.c.id ).\ correlate(None) ).params(groupid=self.id) all_parents = SelectFromCTE(all_parents, s) all_parents = all_parents.alias() q = Group.query.join((all_parents, all_parents.c.id==Group.id)) return q.all() and it's ok now ! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/ji9w6r2l09IJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] joining to a from_statement
Hi list, I'm using SA 0.6.7, Python 2.6.5 and Postgres 8.4 on Ubuntu 10.04 LTS I'm trying to optimize my code against postgres by using the recursive statements CTE as documented here : http://www.postgresql.org/docs/8.4/interactive/queries-with.html My model is a group graph ( many to many relation on itself) I've pasted a self running test of my code : http://pastebin.com/1Vc2PFLx the syntax is elixir's but that is not relevant the pure SQL query only includes id and rank (in my real life object, I have many fields, and they evolve) as seen in comment of the code, when I get detailed information on the result, a new SELECT query is issued for every attribute not yet loaded What I want to achieve : have all the attributes eager loaded without having to explicitely declare them in the PG specific query (for code maintenability) An approach I can't finalize : the idea was to run the PG select and have the result stored in a 2 columns temp table (how ?) and then query the groups (to have the ORM) while joining to this temp table. something like hierarchy_q = session.query(Group.id, 'rank').from_statement(group_all_groups).params(GROUPID=self.id).subquery() session.query(Group).join((hierarchy_q, Group.id==hierarchy_q.c.id) but : *** AttributeError: 'Annotated_TextClause' object has no attribute 'alias' Ideally, I would like a way to have a session.query(Group,'rank') where all the groups' attributes are loaded. Moreover, I wish to have a way of joining this query through relationships. For instance, Groups will have users, I would like to efficiently be able to do something like session.query(User).join(hierarchy_query).order_by(rank) to get all the users of the group, ordered by the rank of the group they belong to. I've read https://groups.google.com/forum/?fromgroups#!topic/sqlalchemy/VAttoxkLlXw but I don't feel my question is exactly the same, as I wish to keep the rank information (only available in the text query) any enlightening idea would be very welcome thanks NiL -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/OIgzgCxD-rgJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] strange commit behaviour
Hi list, I have a turbogears controller, the model are elixir defined. def copy(self, scenario_id, **kwargs): copy a scenario :param scenario_id: id of a :class:`model.Scenario` :type media_id: string user = request.environ['repoze.who.identity']['user'] scenario = Scenario.get(scenario_id) clone = Scenario(owner = user) Session.add(clone) Session.commit() from nose.tools import set_trace; set_trace() details = kwargs.get('details', False) return dict(scenario=clone, details=details) I'm bound to a postgres database. just before the commit, I can observe a IDLE in transaction lock in PG (normal) Then I commit() the output from sqla debug is something like : 2011-06-28 09:56:16,804 INFO sqlalchemy.engine.base.Engine.0x...3dcc BEGIN (implicit) 2011-06-28 09:56:16,806 INFO sqlalchemy.engine.base.Engine.0x...3dcc SELECT user.user_id AS user_user_id, user.user_name AS user_user_name, user.password AS user_password, user.password_check AS user_password_check, user.email_address AS user_email_address, user.display_name AS user_display_name, user.created AS user_created, user.active AS user_active, user.permission_assoc_id AS user_permission_assoc_id FROM user WHERE user.user_id = %(param_1)s and thus IDLE in transaction is back. When I run this in test, the next thing is the tear down, that will try to drop all tables to run next test, and everything will get stuck what am I missing here ? regards NIL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: strange commit behaviour
thanks for your prompt reply still if I do something like http://pastebin.com/UMRcYjp3 (The ordering in children demo is pointless for what I care now) It freezes against a PG database, I need to drop the tables for a second test to run in isolation, and I can't manage to, the commit isn't usued. thanks for any advice NIL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Single Table Inheritance with same Column Name
Hi http://www.sqlalchemy.org/docs/06/orm/extensions/declarative.html?highlight=synonym#sqlalchemy.ext.declarative.synonym_for seems close to what you want -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Multi-Processing Environment
are you using sqlite ? if so : http://groups.google.com/group/sqlalchemy/browse_thread/thread/5e08e49fa1722f91/55940423d2e6f99f?lnk=gstq=nullpool#55940423d2e6f99f http://www.sqlalchemy.org/docs/06/core/pooling.html?highlight=nullpool#switching-pool-implementations might be of help -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] consistency problem while using ordering_list
Hi list, my use case is along those lines, I want collections to maintain an ordered list of items. items can belong to many collections. when an item is deleted, I'd like the list of items from the collection to be updated, and ready to be changed again the comments in the test from the code below show what's go wrong I'm aware of the reorder_on_append option, but the source is discouraging, I'm not even sure it is the way to go reorder_on_append Default False. When appending an object with an existing (non-None) ordering value, that value will be left untouched unless ``reorder_on_append`` is true. This is an optimization to avoid a variety of dangerous unexpected database writes. so, my questions are : - is there a way to obtain the expected behaviour ? how? thanks NIL - # -*- coding: utf-8 -*- from nose.plugins.attrib import attr import unittest from sqlalchemy import (create_engine, Column, Integer, String, ForeignKey, ) from sqlalchemy.orm import relationship from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.associationproxy import AssociationProxy from sqlalchemy.ext.orderinglist import ordering_list from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() engine = create_engine('sqlite:///sqlaordering.db') Session = sessionmaker(bind=engine) session = Session() from sqlalchemy.orm.interfaces import MapperExtension class ReorderCollection(MapperExtension): def after_delete(self, mapper, connection, instance): # this isn't efficient at this stage instance.collection._item_orders.reorder() class Item(Base): __tablename__ = 'items' id = Column(Integer, primary_key=True) name = Column(String(50)) _item_orders = relationship(ItemOrder, cascade='all, delete-orphan', backref='item', ) def __init__(self, name): self.name = name def __repr__(self): return '%r %r' \ % (self.__class__.__name__.capitalize(), self.name) def _create_item_order(item): return ItemOrder(item=item) class Collection(Base): __tablename__ = 'collections' id = Column(Integer, primary_key=True) name = Column(String(50)) _item_orders = relationship(ItemOrder, cascade='all, delete-orphan', backref='collection', order_by=ItemOrder.position, collection_class=ordering_list('position'), ) items = AssociationProxy(_item_orders, item, creator=_create_item_order) def __init__(self, name): self.name = name def __repr__(self): return '%r %r' \ % (self.__class__.__name__.capitalize(), self.name) class ItemOrder(Base): __tablename__ = 'item_orders' id = Column(Integer, primary_key=True) item_id = Column(Integer, ForeignKey('items.id')) collection_id = Column(Integer, ForeignKey('collections.id')) position = Column(Integer) __mapper_args__ = {'extension': ReorderCollection()} class TestOrderedRelation(unittest.TestCase): def setUp(self): Method used to build a database Base.metadata.create_all(engine) session.add_all([Item('T-Shirt'), Item('Mug'), Item('Hat'), Item('Shoes'), Collection('first'), Collection('second'), ]) session.commit() def tearDown(self): Method used to destroy a database Base.metadata.drop_all(engine) @attr('do_it') def test_problem(self): first = session.query(Collection).first() shirt = session.query(Item).get(1) mug = session.query(Item).get(2) hat = session.query(Item).get(3) shoes = session.query(Item).get(4) first.items.append(shirt) first.items.append(mug) first.items.append(mug) first.items.append(shoes) session.commit() assert first.items == [shirt, mug, mug, shoes] session.delete(mug) session.commit() # it seems nice assert first.items == [shirt, shoes] first.items.append(hat) assert first.items == [shirt, shoes, hat] # but at this point the positions are wrong assert session.query(ItemOrder.position).all() == [(0,), (3,), (2,)] session.commit() # the list 'magically' changed (no magic, just wrong index) self.assertFalse(first.items == [shirt, shoes, hat]) # hat took index from len of list when it was inserted assert first.items == [shirt, hat, shoes] # worse indices are still wrong assert
[sqlalchemy] Re: Need Urgent Help -Many to Many Relations
http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html?highlight=association%20proxy#building-complex-views http://stackoverflow.com/questions/2310153/inserting-data-in-many-to-many-relationship-in-sqlalchemy/2310548#2310548 -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Need Urgent Help -Many to Many Relations
your use case is unclear, maybe you could be more specific on what you want to achieve -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Need Urgent Help -Many to Many Relations
http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html#building-complex-views Can anybody explain how to relate three tables with a single association table. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: similiraty search
On Jan 30, 4:16 am, Michael Bayer mike...@zzzcomputing.com wrote: You're in luck since this is a fun relational problem - yes I'm in luck, as everyone on this list to have you around ! thank you so much, I'm quite new to relational problems, and I was way over my head with this one. Now I almost feel as I understand the solution, thanks to your detailed explanation. Surely your answer should finds its way to the cookbook, as maybe this will be of interest to others. Best NiL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] similiraty search
Hi all, let's say I have documents and keywords, join by a many to many relation when I display a document detail, I wish to also display other document that have a maximum of common keyword. so, Doc1 had kwA, kwB and kwC if Doc2 has all 3 kw, and Doc3 2 kw only, I'd like to request them in this order Is it posible ? Now, I would be happy enough with an answer to this first scenario, but we could imagine that the kw themselves have values, kwA is twice the weight of kwB Of course I'm in a sqla environement regards NiL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] counting queries
Hi all, I have an application replying on sqlalchemy that deals with many recursive methods. We manipulate complex graphs. I have tests that validates we get the expected results for each method. Still, many optimization might be done to the code. What I would like is, in my test environment, evaluate the number of queries to the database. I'm aware that the debug mode will output every generated SQL, but I deal with a number of queries in the 100s range ... Is there a way to know how many SQL statement have been executed, from the python testing code ? Regards NiL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: select distinct on a relation to an entity with composite primary key
thank you very much michael, this is some kind of mind spinning sqla expression !! -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] select distinct on a relation to an entity with composite primary key
hi list, I have the following (elixir) definitions class Invoice(Entity): user_name = Field(Unicode(255)) item = ManyToOne(Item) class Item(Entity): item_id = Field(Integer, primary_key=True) service_id = Field(Unicode(255), primary_key=True) item_class = Field(Unicode(255), primary_key=True) I wish to select invoices that have distinct items (Pdb) Session.query(Invoice.item.distinct()) *** RuntimeError: maximum recursion depth exceeded while calling a Python object this works (Pdb) Session.query(Invoice.item_item_id.distinct()) sqlalchemy.orm.query.Query object at 0x988e7ec but doesn't lead to the expected result here is the invoice's table description CREATE TABLE invoice ( id INTEGER NOT NULL, user_name VARCHAR(255), item_item_id INTEGER, item_service_id VARCHAR(255), item_item_class VARCHAR(255), PRIMARY KEY (id), CONSTRAINT invoice_item_item_id_item_service_id_item_item_class_fk FOREIGN KEY(item_item_id, item_service_id, item_item_class) REFERENCES item (item_id, service_id, item_class) ) How can I achieve my query ? regards NIL -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: select distinct on a relation to an entity with composite primary key
Hi Michael, thank you very much for your prompt answer. What I want to achieve is, counting the number of distinct items, grouped by user_name Given Item1: item_id = 1 service_id = 'test' item_class = 'dummy' Item2: item_id = 2 service_id = 'other' item_class = 'dummy' Invoice1: id = 1 user_name = 'lorem' item = Item1 Invoice2: id = 2 user_name = 'lorem' item = Item1 Invoice3: id = 3 user_name = 'ipsum' item = Item1 Invoice4: id = 4 user_name = 'ipsum' item = Item2 the expected result is: user: lorem, distinct item count : 1 user: ipsum, distinct item count : 2 -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: select distinct on a relation to an entity with composite primary key
thanks again but the unicity of Item is guaranteed by the triplet of PK I can't just discriminate the distinct() based on the item_id only (it is not unique by itself in my set of data) -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Passing model objects to other threads
Hi, have you considered using TGScheduler ? -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: internationalization of content
Hi, I must admit that I discovered the test I wrote to assert my approach works for polymorphic content is wrongly True. I'm working at making it reallty work but it is not that easy. Still for non polymorphic content it is quite ok of course, it is completely elixir oriented, but I'm sure it could be ported to pure sqla -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: internationalization of content
Hello again, I published an updated version of acts_as_localized on http://code.google.com/p/elixirlocalized/ It is an Elixir's Entity builder that will manage several translations for DB contents If anyone cares to review or use it. NiL -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: internationalization of content
Hi chris, thanks for your reply. I guess it is not an application framework oriented question. It seems to me rather a question of database design/access. I have a pointer to modify the elixir versioning extension to provide this functionnality. It would be framework oriented, if we were talking about the translations of templates, which is not the case. best NiL -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: internationalization of content
Hi Werner, many thanks for your rich reply. I'm going to try an elixir implementation for now. If you want follow the thread of the same title in the elixir mailing list. I'll stay tuned to any sqla development best NiL -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] internationalization of content
Hi all, I'm lookin for a good solution to internationalize the content of my application. that is provide many translations for the database content (as opposed to the translation of the application itself with babel/gettext for template and code messages). Has anyone tried ti implement this ? a working solution ? willing to participate in a effort to provide a solution ? regards NiL -- 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, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.