[sqlalchemy] a list of int, and check for id

2013-11-19 Thread Mohsen Pahlevanzadeh
I don't know all of function call of sqlalchemy, So i can't use completely, i have a set of integer (id of my table), I should retrieve project_typpe field according to list of my id, What do you suggesst code? my table : (id: int, project_type: text) -- You received this message because you

[sqlalchemy] struggling with simple aggregation

2013-11-19 Thread Chris Withers
Hi All, I have this simple model/table: class Part(Common, Base): __tablename__ = 'transaction' id = Column(Integer(), primary_key=True) # one per transaction part = Column(Integer(), primary_key=True) # one per part timestamp = Column(DateTime(), nullable=False) source =

Re: [sqlalchemy] struggling with simple aggregation

2013-11-19 Thread Michael Bayer
On Nov 19, 2013, at 7:10 AM, Chris Withers ch...@simplistix.co.uk wrote: Hi All, I have this simple model/table: class Part(Common, Base): __tablename__ = 'transaction' id = Column(Integer(), primary_key=True) # one per transaction part = Column(Integer(),

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Jonathan Vanasco
On Monday, November 18, 2013 8:40:13 PM UTC-5, Michael Bayer wrote: there’s a recipe for doing this with events: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionModifiedSQL Oh wow. This is great. Playing with it now. I still like my idea for syntax though , it's simpler and

[sqlalchemy] logging question

2013-11-19 Thread Jon Nelson
Greetings, once more! I'm having some trouble with logging. Before I call any sqlalchemy functions or bits (but after sqlalchemy is imported), I use logging.config.fileConfig(...) to configure the logging. The file is set to configure sqlalchemy at NOTSET and sqlalchemy.engine and

Re: [sqlalchemy] logging question

2013-11-19 Thread Michael Bayer
On Nov 19, 2013, at 12:39 PM, Jon Nelson jnel...@jamponi.net wrote: Greetings, once more! I'm having some trouble with logging. Before I call any sqlalchemy functions or bits (but after sqlalchemy is imported), I use logging.config.fileConfig(...) to configure the logging. The file is

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Jonathan Vanasco
Thats a great idea. I'll tackle that next. I'm having a bit of trouble adapting the recipe to my existing [pyramid] application. I'm not seeing a .info property on my sessions in `_connection_for_session`. I am using scoped sessions, and the recipe does work fine on this machine /

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Michael Bayer
On Nov 19, 2013, at 1:33 PM, Jonathan Vanasco jonat...@findmeon.com wrote: Thats a great idea. I'll tackle that next. I'm having a bit of trouble adapting the recipe to my existing [pyramid] application. I'm not seeing a .info property on my sessions in `_connection_for_session`.

Re: [sqlalchemy] logging question

2013-11-19 Thread Jon Nelson
On Tue, Nov 19, 2013 at 12:17 PM, Michael Bayer mike...@zzzcomputing.com wrote: SQLAlchemy will affect the config of logging only if any of the “echo” flags are used - the effect of echo=True is that it calls logging.basicConfig(). This config will occur in addition to the config that you

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Jonathan Vanasco
how stable is 0.9 ? is it fairly safe to switch to now ? -- 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

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Michael Bayer
yeah 0.9.0 is imminent, more or less, I might want to put a few more things into it, nobody’s really been reporting regressions so I suppose I’ll get them when the library is actually on Pypi. On Nov 19, 2013, at 2:28 PM, Jonathan Vanasco jonat...@findmeon.com wrote: how stable is 0.9 ? is

Re: [sqlalchemy] [wishlist] ORM/engine Feature Request - comment()

2013-11-19 Thread Jonathan Vanasco
screw it. updated to 0.9. everything works as-needed within 5 minutes. happy. -- 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

Re: [sqlalchemy] selecting entities from a cte joined to another table

2013-11-19 Thread Chris Withers
On 19/11/2013 14:49, Michael Bayer wrote: This query (which seems simple enough to me): session.query(Part.instrument, func.sum(Part.quantity))\ .filter((Part.account_id=='td') (Part.timestamp date(2013, 11, 1)))\ .group_by(Part.instrument)\ .all() we don’t support

Re: [sqlalchemy] selecting entities from a cte joined to another table

2013-11-19 Thread Michael Bayer
you want to label your func.sum() in the CTE: positions = session.query(Instrument, func.sum(Part.quantity).label(quantity))\ then refer to quantity and instrument_id using .c. since positions is now a core CTE element: session.query(Instrument, positions.c.quantity, Observation)\

[sqlalchemy] ORM join question

2013-11-19 Thread askel
Hello everybody, I have a question I couldn't find answer on my own so I'll greatly appreciate if someone could give me an answer. Considering simple model https://gist.github.com/momyc/7554839, why would query like the following work:

Re: [sqlalchemy] ORM join question

2013-11-19 Thread Michael Bayer
On Nov 19, 2013, at 7:11 PM, askel dummy...@mail.ru wrote: Hello everybody, I have a question I couldn't find answer on my own so I'll greatly appreciate if someone could give me an answer. Considering simple model https://gist.github.com/momyc/7554839, why would query like the

Re: [sqlalchemy] ORM join question

2013-11-19 Thread askel
Thank you Michael for quick response. On Tuesday, November 19, 2013 8:36:55 PM UTC-4, Michael Bayer wrote: On Nov 19, 2013, at 7:11 PM, askel dumm...@mail.ru javascript: wrote: Hello everybody, I have a question I couldn't find answer on my own so I'll greatly appreciate if someone could

[sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Seth P
I have an issue where, I believe due to floating-point representation issues, reassigning the same value to a floating-point field causes SQLAlchemy to think the value has been modified, and therefore emits a gratuitous UPDATE. (This is particularly problematic when using the versioning mixin,

Re: [sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Michael Bayer
On Nov 19, 2013, at 8:10 PM, Seth P spadow...@gmail.com wrote: I have an issue where, I believe due to floating-point representation issues, reassigning the same value to a floating-point field causes SQLAlchemy to think the value has been modified, and therefore emits a gratuitous UPDATE.

Re: [sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Michael Bayer
heh, this is actually some dumb numpy thing, check this out: from numpy.ma.core import exp x = exp(1.0) a = x == x a True a is True False there’s your problem, the recipe fixes if you just say this: class InexactFloat(TypeDecorator): impl = Float def compare_values(self, x, y):

Re: [sqlalchemy] session.is_modified() and floating-point numbers

2013-11-19 Thread Seth P
Huh. That is odd numpy behavior. Thanks for the recipe. On Tuesday, November 19, 2013 8:35:35 PM UTC-5, Michael Bayer wrote: heh, this is actually some dumb numpy thing, check this out: from numpy.ma.core import exp x = exp(1.0) a = x == x a True a is True False there’s your

Re: [sqlalchemy] Invalid query formed: table listed twice in FROM

2013-11-19 Thread Michael Woods
I can send an example later, but first I'll describe the general scenario which may be causing the issue. I dug through the codebase and removed any code that I thought could be potentially causing some weird object aliasing problems. To provide some insight, I'm building an adhoc query tool