this is more of a SQL question. You’d want to query on max(timestamp) and group by name/value.
assuming you haven’t worked with GROUP BY before, go through a tutorial like http://www.w3schools.com/sql/sql_groupby.asp and figure out exactly what plain SQL you want. Then bring that back here where we can illustrate that as SQLAlchemy. If you already know what SQL you want then just show me that here. Ahmed Ezzeldin <[email protected]> wrote: > products_attribute = Table(Column('id', INTEGER()), Column('product_id', > INTEGER(), ForeignKey(u'product.id')), Column('name', TEXT()), > Column('value', TEXT()), Column('timestamp', TIMESTAMP()) > > > product_id name value timestamp > 23 'Price' 1578.0 > datetime.datetime(2014, 10, 24, 11, 16, 47, 309000) > 23 'Price' 1838.0 > datetime.datetime(2014, 11, 9, 10, 48, 18, 533000) > 23 'Price' 1840.0 > datetime.datetime(2014, 10, 5, 2, 55, 34, 31000) > 23 'Price' 1599.0 > datetime.datetime(2014, 9, 11, 15, 1, 17, 595000) > 23 'Brand' hp > datetime.datetime(2014, 9, 11, 15, 1, 17, 596000) > 23 'Brand' hp > datetime.datetime(2014, 9, 12, 12, 2, 12, 523200) > > > > How can I get the most recent row from multiple names and values with the > same name ?? > > > -- > 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 [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/sqlalchemy > <http://groups.google.com/group/sqlalchemy>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
