Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-10 Thread 'Matt Zagrabelny' via sqlalchemy
On Tue, Jun 8, 2021 at 11:58 AM Mike Bayer wrote: > > Unknown network failures, I suppose. I have an application that is > throwing an exception right now due to: > > psycopg2.OperationalError: terminating connection due to administrator > command > SSL connection has been closed unexpectedly >

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread 'Matt Zagrabelny' via sqlalchemy
On Tue, Jun 8, 2021 at 10:28 AM Mike Bayer wrote: > > > > however, I would advise using pool_pre_ping instead which is much easier > to use and has basically no downsides.this feature didn't exist when > the docs for "optimistic disconnect" were written. > > > Sure. I was only looking at

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread 'Matt Zagrabelny' via sqlalchemy
Hi Mike, Thanks for the reply! On Mon, Jun 7, 2021 at 6:08 PM Mike Bayer wrote: > ORM Sessions ride on top of connections, but since the Session under it's > default pattern of being bound to an Engine does the "connect" internally, > it's probably inconvenient to adapt the optimistic

[sqlalchemy] Session and optimistic disconnect handling

2021-06-07 Thread 'Matt Zagrabelny' via sqlalchemy
Greetings SQLAlchemy folks, I am following the guide at [0] for recovering from a database error in my SQLAlchemy code. I normally use sessions for my SA work and am wondering if sessions will work with the aforementioned SA example. My initial attempt to combine the example at [0] with sessions

Re: [sqlalchemy] correct usage of next_value for a sequence

2021-04-20 Thread 'Matt Zagrabelny' via sqlalchemy
On Tue, Apr 20, 2021 at 1:14 PM Mike Bayer wrote: > > > On Tue, Apr 20, 2021, at 1:52 PM, 'Matt Zagrabelny' via sqlalchemy wrote: > > Greetings SQLAlchemy, > > I'm attempting to use the next_value function to get the (next) value from > a sequence: > > cycle

[sqlalchemy] correct usage of next_value for a sequence

2021-04-20 Thread 'Matt Zagrabelny' via sqlalchemy
Greetings SQLAlchemy, I'm attempting to use the next_value function to get the (next) value from a sequence: cycle_counter = next_value(Sequence('cycle_seq')) print(cycle_counter) However, the print statement yields: Does anyone know the correct way to get the value of a

[sqlalchemy] Is there a built-in concept of model/schema versioning?

2020-01-24 Thread Matt S
Does Alembic has the concept of versioned schemas/models? In Alembic, I need to re-define a model which matches the database table for the current migration. Becomes verbose after several migrations, redefining the same out-of-date model. So I created a "legacy_models" module where I define old

Re: [sqlalchemy] Re: converting row object to dict

2018-08-25 Thread Matt Zagrabelny
Thanks for the help Jonathan and Mike. -m On Sat, Aug 25, 2018 at 8:16 AM, Mike Bayer wrote: > just as a note, that's also not a "row" object you are getting back, you > are getting ORM mapped instances. if you want rows which you can call > dict() directly on them, use a Core expression,

[sqlalchemy] converting row object to dict

2018-08-24 Thread Matt Zagrabelny
Greetings, I've searched the group archives and looked at StackOverflow (sorry!) and couldn't come up with the canonical way to convert a row object to a dict. Here are some code snippets: Base = declarative_base() class Station( Base, ): __tablename__ = 'stations' id=

[sqlalchemy] standalone asc/desc function vs ColumnElement asc/desc function

2018-02-28 Thread Matt Zagrabelny
Greetings, Are there any reasons (canonical, stylistic, etc.) that one would use order_by(desc(Class.column)) vs order_by(Class.column.desc()) ? Thanks! -m -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please

Re: [sqlalchemy] Performance of ORDER BY vs. list.sort() vs. sorted()

2018-02-28 Thread Matt Zagrabelny
On Wed, Feb 28, 2018 at 3:02 PM, wrote: > Hello, > > I’m curious about your experience with sorting the results of all() > > queries which return a list. It seems to me that there are

[sqlalchemy] Re: load_only change in 1.2.0?

2018-01-10 Thread Matt Schmidt
The version I upgraded from was 1.1.9, and I originally started the project on 1.1.1. I saw that bug and thought that was it, but then noticed that was a number of versions ago. On Wednesday, January 10, 2018 at 1:54:54 PM UTC-5, Jonathan Vanasco wrote: > > what version did you update from?

[sqlalchemy] load_only change in 1.2.0?

2018-01-10 Thread Matt Schmidt
functionality of the library. -Matt -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description

Re: [sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-14 Thread Matt
On Wednesday, December 14, 2016 at 3:58:19 PM UTC+1, Mike Bayer wrote: > > > When you want to switch between "writer" and "reader", the "reader" must > be fine with using a totally clean transaction and that means totally > new objects and everything inside that Session as well. For a web >

[sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-13 Thread Matt
I am currently writing a Flask web application that uses Flask-SQLAlchemy to communicate with a Postgres database. I want to have several read-replicas to which all database read queries can be directed, while all read+write queries can go to the master database instance. In other words, a

Re: [sqlalchemy] Using sqlalchemy dburi with Oracle using External Password Store (Oracle Wallet)?

2016-05-27 Thread Matt Vasquez
-5, Mike Bayer wrote: > > get it working with regular cx_oracle first. I'm not familiar with > external password store so you should ask on the cx_oracle mailing list > (https://sourceforge.net/p/cx-oracle/mailman/cx-oracle-users/) > > > > On 05/27/2016 10:18 AM, Mat

[sqlalchemy] Using sqlalchemy dburi with Oracle using External Password Store (Oracle Wallet)?

2016-05-27 Thread Matt Vasquez
down votefavorite I am trying to get a oracle sqlalchemy dburi working with an external password store (Oracle Wallet) I have tried using the standard sqlplus syntax for a external

[sqlalchemy] "cache lookup failed" on reflection

2016-02-23 Thread Matt Smith
), is causing our code to error during schema reflection. Does this sound correct to you, and if so, is there a way for our code to mitigate this issue? Thanks, Matt Smith Here's the relevant portion of the stack trace: ... snip ... engine, meta = ENGINES.get('redshift'), ENGINES.get_meta

Re: [sqlalchemy] Composite primary key with nullable columns

2016-01-05 Thread Matt Zagrabelny
On Tue, Jan 5, 2016 at 11:11 AM, Paul Johnston wrote: > Hi, > > I have a situation where I'm trying to us a composite primary key, where one > of the columns can be null. > > However, when I try to update an object I get the following error: > sqlalchemy.orm.exc.FlushError:

[sqlalchemy] passing a dictionary to a Base derived constructor?

2015-11-30 Thread Matt Zagrabelny
Greetings, I've googled a bit, checked the sqlalchemy group archives, and looked at the API for resolution to the following question, but came up short on a definitive answer. I've got a table with a number of fields. It is defined as such: from sqlalchemy.ext.declarative import

Re: [sqlalchemy] from_statement, TextAsFrom and stored procedures

2014-02-07 Thread Matt Phipps
you too much about the TextAsFrom feature! I feel like if I asked any other ORM to be this flexible they would either laugh or cry. SQLAlchemy is the first ORM I've worked with since using Rails as an intern, and I'm spoiled now with how awesome it is :) -Matt -- You received this message

Re: [sqlalchemy] from_statement, TextAsFrom and stored procedures

2014-02-07 Thread Matt Phipps
Sounds great; I agree avoiding the naming convention is ideal. For my project the only reason we're using a text clause is to call a stored procedure, which definitely can't go in a subquery, so I'm not sure how well I can weigh in on the aliasing stuff. -Matt On Fri, Feb 7, 2014 at 1:43 PM

Re: [sqlalchemy] from_statement, TextAsFrom and stored procedures

2014-02-05 Thread Matt Phipps
to be disabled for TextAsFrom objects. Here's a gist of the nose test suite that helped me figure out what was working and what wasn't: https://gist.github.com/garaden/8835587 On Sun, Feb 2, 2014 at 5:42 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Feb 2, 2014, at 4:31 PM, Matt Phipps

Re: [sqlalchemy] AttributeError: 'CompositeProperty' object has no attribute 'props'

2014-02-04 Thread Matt Phipps
=configure_mappers#compile-mappers-renamed-configure-mappers-simplified-configuration-internals. Thanks, Matt -- 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

[sqlalchemy] Help requested debugging a tricky query with join-dependent hybrid property

2014-01-15 Thread Matt Schmidt
with hybrid properties? Or should I be looking to alter the query instead? Note: I tried doing a simple select expression for start_date, but it wasn't performing as well as I'd like. Any help is much appreciated! Thanks! -Matt -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] Help requested debugging a tricky query with join-dependent hybrid property

2014-01-15 Thread Matt Schmidt
Very good! Thank you! On Wednesday, January 15, 2014 1:17:56 PM UTC-5, Michael Bayer wrote: On Jan 15, 2014, at 12:58 PM, Matt Schmidt slo...@gmail.com javascript: wrote: So here's a simplified version of the models I have: http://pastie.org/private/smqzkvz4zj46skfmipruw Python==3.3

[sqlalchemy] Enforcing order of operations when using SQL Expression Language

2013-07-31 Thread Matt Murphy
. Also, I am not too familiar with how to properly define comparators for a composite. Am I doing this in an acceptable way? Or is there a better way to get the two sets of columns and compare them? I copied the base code from SQLAlchemy Docs. Thanks, Matt -- You received this message because

[sqlalchemy] quoting in a sub clause

2013-07-23 Thread matt g
are having problems because the UNLOAD(http://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html) statement requires that the internal select be wrapped in single quotes. What would be the best way to ensure that the bind params for the enclosing select clause be escaped properly? thanks, Matt

Re: [sqlalchemy] quoting in a sub clause

2013-07-23 Thread matt g
, for example), you need to escape them in the query text. For example: ('select * from venue where venuestate=\'NV\'') On Tuesday, July 23, 2013 10:22:09 AM UTC-5, Michael Bayer wrote: On Jul 23, 2013, at 11:09 AM, matt g mge...@gmail.com javascript: wrote: Hi, We are using

[sqlalchemy] Retreiving datetime(6) value using sqlalchemy

2013-07-11 Thread Matt
insight would be great. Thanks, Matt -- 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, send email

[sqlalchemy] Re: Retreiving datetime(6) value using sqlalchemy

2013-07-11 Thread Matt
Sorry, forgot to mention this is for mysql. http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html On Thursday, July 11, 2013 4:38:03 PM UTC-4, Matt wrote: Hi all, I have been writing to my database using func.now(6) for datetime(6) valued columns and it has worked perfectly

Re: [sqlalchemy] oracle cursor outparameters

2012-09-23 Thread matt g
For the parts I'm working on right now, this is perfect. Thank you. Matt On Friday, September 21, 2012 5:19:17 PM UTC-5, Michael Bayer wrote: On Sep 21, 2012, at 3:49 PM, matt g wrote: Hi, I'm working with a client that does most of their work in stored procedures on an oracle database

[sqlalchemy] oracle cursor outparameters

2012-09-21 Thread matt g
and do something like this: db.execute(text('begin HELLO_WORLD.say_hi(:x_in, :x_out); end;',bindparams=[bindparam('x_in',String),outparam('x_out',String)]),x_in='matt'). However, for most of their procedures, they actually have cursors in the outparams. The only way i have found to do it is to drop

[sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
I have a SMALLINT column in MSSQL. The value of the column is -2 SQLAlchemy also has the column as SMALLINT but the value is translated as 4294967294 I can't seem to correct this and I haven't found anything on SA and negative numbers. Any help would be really great, thanks. -- You

Re: [sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
makes sense.. I'm using pydobc. I do the test you suggested.. thanks! -- 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/-/4XlySuLtQxUJ. To post to this group, send

[sqlalchemy] Re: Softcoding .filter(...)

2011-09-29 Thread Matt Bodman
I think he means that if you only need an exact match on your query (instead of a 'like' or a '' etc) you can do this: dict_from_web = {'Title':'The Book','Author':'Bob Smith'} for b in session.query(Book).filter_by(**dict_from_web) will return the books that have the exact Title 'The Book'

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-25 Thread Matt Bodman
, FetchedValue()) Thanks again, Matt -- 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/-/l8KrkR59HGQJ. To post to this group, send email to sqlalchemy@googlegroups.com

[sqlalchemy] Autoloading ManyToMany association table

2011-09-25 Thread Matt Bodman
I am autoloading an MSSQL db. There are a few ManyToMany assoc tables. I'm not sure how to map everything. Here's a typical example of how they look in the db: Table: tbUsersToGroups PK: ID_UserToGroup FK: User_ID FK: Group_ID So I can successfully autoload that assoc table and

[sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-15 Thread Matt Bodman
column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column. (273) (SQLPrepare)' Is there a way around this without having to map every column explicitly? Thanks, Matt -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-15 Thread Matt Bodman
Hi Michael, Thanks for your reply. Please be patient with me though as I don't quite get it. Where and when is the add_default function called? Won't I get the same error trying to insert 'some default' into the column? Any further explanation would be great. Matt -- You received

[sqlalchemy] Looking for examples of SQLAlchemy in WSGI apps

2009-07-13 Thread Matt Wilson
middleware. I found SQLAlchemyManager, but it explicitly states it is NOT the recommended way. Is it still safe to use? More generally, all advice on using SQLAlchemy + homemade WSGI would be helpful. Thanks! Matt --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Can I write this query with SQLAlchemy?

2008-12-04 Thread Matt Wilson
Right now, I'm writing this query as a string. I want to know if it can be expressed with SQLAlchemy's expressions instead. Here's the query: select sh.employee_id, sum(st.stop_time - st.start_time) as hours from shift sh, shift_time st where sh.employee_id in (28630, 28648) and

[sqlalchemy] Re: Can I write this query with SQLAlchemy?

2008-12-04 Thread Matt Wilson
Thanks! This is really helpful. On Dec 4, 11:43 am, Michael Bayer [EMAIL PROTECTED] wrote: hi matt - here's that query generated using lexical tables, which are just like   Table objects but require less boilerplace for SQL prototyping purposes: from sqlalchemy import * from

[sqlalchemy] circular model definitions

2008-07-09 Thread Matt Haggard
I'm stumped... Setup: (Problem statement near the bottom) In my Pylons app, I have three separate models: Customer, TPPAnswer, SAQ TPPAnswer is many-to-one Customer SAQ is many-to-one Customer Both have backreferences (so saq.customer and customer.saqs) Currently, I have them defined in

[sqlalchemy] subtle AttributeError in 0.4.5

2008-06-30 Thread matt harrison
'exceptions.AttributeError': adweekid I'll refresh the page and it will work. I'll open the pylons debug page and type: cal_table.c.adweekid and table.c.adweekid and neither will throw an AttributeError, but will just work. Any ideas?!? thanks, matt --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: subtle AttributeError in 0.4.5

2008-06-30 Thread matt harrison
On Jun 30, 2:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 30, 2008, at 4:41 PM, matt harrison wrote: Folks- I'm (seemingly) randomly running across this issue in my pylons/SA app. I'm generating a SQL where clause like so: where = sa.and_(cal_table.c.adweekid

[sqlalchemy] ProgrammingError: (ProgrammingError) current transaction is aborted, commands ignored until end of transaction block

2008-06-27 Thread Matt Haggard
. I wonder if there's some sort of handle releasing I need to do... or transaction releasing? As a side note... I test using SQLite and put in production with Postgres, and the page works wonderfully in SQLite -- it's only Postgres that has the problem. Thanks, Matt Here are the methods called

[sqlalchemy] Re: ProgrammingError: (ProgrammingError) current transaction is aborted, commands ignored until end of transaction block

2008-06-27 Thread Matt Haggard
, Matt Haggard wrote: I'm getting a ProgrammingError (I've pasted the last part of the traceback at the bottom of the page). The error comes from my first heavy-AJAX page in Pylons (postgres backend).  If I cause too many AJAX requests at a time, or even after doing 3 non-overlapping

[sqlalchemy] Re: ProgrammingError: (ProgrammingError) current transaction is aborted, commands ignored until end of transaction block

2008-06-27 Thread Matt Haggard
: On Jun 27, 2008, at 5:03 PM, Matt Haggard wrote: INSERT or UPDATE?  I don't do any inserts with this code... only changing what's already there. Is an integrity constraint a PG thing, or SQLAlchemy model thing? its a PG thing.  Other things can likely cause PG to get into this   state

[sqlalchemy] Models split across files

2008-06-24 Thread Matt Haggard
to generate a foreign key % tname) InvalidRequestError: Could not find table 'customer' with which to generate a foreign key I've included a before and after (hooray for GIT) of the models: Thanks! Matt saq.py before (this one works) from sqlalchemy

[sqlalchemy] Re: Triple Join Table

2008-06-17 Thread Matt Haggard
. On Jun 16, 5:11 pm, Matt Haggard [EMAIL PROTECTED] wrote: I've got a triple join table (joining three things together) and I'm really struggling to get it to work as I intend.  I've pasted the full model at the bottom.  I've struggled with this off and on for months now... I don't really

[sqlalchemy] appending an object through an 2-level association table

2008-05-07 Thread Matt Haggard
it to also insert the type_id? Thanks, Matt - questions_table : id | question sections_table : id | name types_table : id | name join_table : type_id | question_id | section_id class QType(object): allquestions = association_proxy('joinObj

[sqlalchemy] Re: Goofy Association Table

2008-05-06 Thread Matt Haggard
are all the Questions (ignoring the Sections; grouping by Questions)? my_type = Type() all_questions = my_type.questions ?? I appreciate the help, Matt On May 5, 3:32 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 5, 2008, at 5:11 PM, Matt Haggard wrote: I've got a kind of goofy

[sqlalchemy] Goofy Association Table

2008-05-05 Thread Matt Haggard
this error when I try to save a type object: AttributeError: 'PropertyLoader' object has no attribute '_dependency_processor' Thanks, Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] filter_by mapped class attribute?

2008-04-24 Thread Matt
to the DB seems to be missing the join between the tables for A and B... Sqlalchemy 0.3 BTW... thx Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Re: filter_by mapped class attribute?

2008-04-24 Thread Matt
ctx.current.query(B).filter_by(A.c.name.like('%foo%')) added the join manually: ctx.current.query(B).filter(B.c.xid == A.c.xid).filter_by(A.c.name.like('%foo%')) m On Apr 24, 2:33 pm, Matt [EMAIL PROTECTED] wrote: I have 2 classes A and B which are mapped each to their own table

[sqlalchemy] 0.3.x eagerload error

2008-02-14 Thread Matt
I'm having some trouble configuring eager loading for a query: Query: domainq = ctx.current.query(Domain).options(eagerload('company')).all() Mapper: domainmapper = mapper(Domain, domains, extension=ModifiedMapper(), properties={ 'company' : relation(Company, uselist=False), } )

[sqlalchemy] Handling unique constraints

2008-01-04 Thread Matt Haggard
the db? 2) How do I let the user know which value caused the record not to update? What information does SQLAlchemy provide back that I can use to say: You're number must be unique... and such-and-such must be greater than 0, etc..? Thanks, Matt Haggard

[sqlalchemy] Re: eagerload and joined table inheritance

2007-12-31 Thread Matt
, content_leaf)]).order_by(content_table.c.content_id.desc()) rp = Session.execute(s) This works pretty well and I think from the DB side, this is about as fast as it can get since I'm pulling back the minimum amount of data with a simple query. thx Matt On Dec 30, 5:51 pm, Michael Bayer

[sqlalchemy] Re: Fancy transaction questions

2007-12-31 Thread matt
so by a subsequent database access. -matt On Dec 28, 5:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: Im assuming you're writing an ORM centric application for my answers below. If not, the answers would be slightly different. On Dec 28, 2007, at 8:02 PM, Glypho Phobet wrote: Problem #1: I

[sqlalchemy] eagerload and joined table inheritance

2007-12-30 Thread Matt
loader If I remove the select_table, the account property will then eagerload, but I really want both to eagerload in the same query. Any ideas on how to make this happen? thx Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: eagerload and joined table inheritance

2007-12-30 Thread Matt
something like: q = Session.query(Content).add_entity(Account).select_from(content_table.outerjoin(accounts)) To get the account? thx m On Dec 30, 2:53 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Dec 30, 2007, at 3:20 PM, Matt wrote: Hi all, I'm having an issue where I'm doing a query

[sqlalchemy] sqlalchemy object serialization / deserialization

2007-12-20 Thread Matt
Hi all, I'm trying to implement simple object serialization (ala the pickle module) using JSON. I'm pretty far along, but having one problem -- serializing a sqlalchemy object through the __reduce__ method produces a circular reference through the InstanceState object. pprint of the structures

[sqlalchemy] Re: sqlalchemy object serialization / deserialization

2007-12-20 Thread Matt
On Dec 20, 5:04 pm, Rick Morrison [EMAIL PROTECTED] wrote: You're not going to be able to serialize Python class instances in JSON: json strings are simple object literals limited to basic Javascript types. Pickle does some pretty heavy lifting to serialize and reconstitute class instances.

[sqlalchemy] Re: Sum with Grouping

2007-11-21 Thread Matt Haggard
Oh, okay. Thanks you. On Nov 20, 5:23 pm, Michael Bayer [EMAIL PROTECTED] wrote: the aggregate methods on Query, such as apply_sum(), apply_avg(), etc., are not in such great shape right now...they've been neglected and in fact aren't even working correctly with GROUP BY, etc...I've added

[sqlalchemy] Re: Sum with Grouping

2007-11-21 Thread Matt Haggard
thank you for the response. I have a few more followup questions (I am really a newbie to this...) : 1. Where does engine come from? Is there anyway to do what you've suggested with Session? If it helps, I'm using this with pylons and am trying to get stuff working in the controller of my app.

[sqlalchemy] Sum with Grouping

2007-11-20 Thread Matt Haggard
I'm very new to sqlalchemy and I'm still trying to wrap my head around how it works. I have a table with columns: type, amount. I want to sum the amounts grouped by type. In SQL I would write: SELECT sum(amount), type from purchases group by type; How do I do this with SQLAlchemy? This is

[sqlalchemy] Error with query and joined table inheritance

2007-11-18 Thread Matt
I have some classes that inherit from one another, here are the mappers: mapper(Content, content, polymorphic_on=content.c.type, polymorphic_identity='content') mapper(TvContent, content_tv_metadata, inherits=Content, polymorphic_identity='tv show') mapper(SoftwareContent,

[sqlalchemy] Re: Error with query and joined table inheritance

2007-11-18 Thread Matt
Thanks for the insight Michael -- some records in the content table had a 'type' of one of the subclasses, but not a record in the corresponding subclass table -- works like a charm once I insert records for everything in the subclass tables. Matt On Nov 18, 7:58 pm, Michael Bayer [EMAIL

[sqlalchemy] Re: Can I remove a Column from the select() result set

2007-11-17 Thread Matt Culbreth
, Matt Culbreth wrote: Howdy Group, Let's say I have a very simple query: select person.id, person.name, person.age from person Can I remove one of the columns, say person.age, from this result set and still use the list as a RowProxy? I'm trying to do it now and it's not working

[sqlalchemy] Can I remove a Column from the select() result set

2007-11-16 Thread Matt Culbreth
and appending all but the last (for example) columns, but it's then missing the RowProxy goodness. I realize I can do this in the original select, but I'm doing some client-side logic here and I need to manipulate the dataset. Thanks, Matt --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: adding an object through association_proxy

2007-11-01 Thread Matt
I think I misunderstood the use of the association proxy -- I don't think I want to use it in this case anymore... thx m On Oct 31, 6:33 pm, Matt [EMAIL PROTECTED] wrote: Hi all, I have a table (Content) which relates to itself via a many-to-many relationship through a link table

[sqlalchemy] adding an object through association_proxy

2007-10-31 Thread Matt
(), UTC_TIMESTAMP(), %s, %s, %s)' [0, None, None, 79940L, None, None] Seems to only be supplying the id for the child and not the parent when it's creating the intermediate table record... Any ideas what I'm doing wrong here? thx Matt --~--~-~--~~~---~--~~ You

[sqlalchemy] advanced mapping help

2007-06-23 Thread Matt
to be able to set a couple fields on the ContentCollection table, but I don't actually have a property for those fields on the Content object anywhere since I'm mapping through that table... Any ideas on how I should handle this? thx Matt --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: advanced mapping help

2007-06-23 Thread Matt
actually have a property for those fields on the Content object anywhere since I'm mapping through that table... Any ideas on how I should handle this? thx Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Anybody seen--Exception: invalid byte sequence for encoding UTF8?

2007-06-02 Thread Matt Culbreth
, 'date_hired': datetime.date(2004, 1, 1), 'address': 'P.O. Box 815, 6723 Eget, Ave', 'commission_percentage': 0.080120064101811897} Has anybody seen this? Do I need to do a convert_unicode or anything like that? Thanks, Matt --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Re: Anybody seen--Exception: invalid byte sequence for encoding UTF8?

2007-06-02 Thread Matt Culbreth
, Matt Culbreth wrote: Howdy All, I've got some existing code that I'm trying on a new server. The code was formerly running with Python 2.4 and SA 0.36, but this new server is running Python 2.5 and SA 0.37. Anyway, I've got a small program which is loading a PostgreSQL 8.2 db from

[sqlalchemy] Asynchronous SQLAlchemy--Anybody using Twisted, sAsync?

2007-02-19 Thread Matt Culbreth
of clients, etc. The sAsync project at http://foss.eepatents.com/sAsync/ seems ideally suited for this but I haven't seen any comments about it here. Thanks, Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] How to determine if an instance has been populated?

2007-02-12 Thread Matt Culbreth
fine if the object has been loaded, but throws a TypeError exception until that time because one of the statements in the __repr__() method is using an 'int' type. I can easily handle this by checking for None of course, but is there a more standard way people use the tool? Thanks, Matt

[sqlalchemy] Re: How to determine if an instance has been populated?

2007-02-12 Thread Matt Culbreth
That got it, thanks. On Feb 12, 3:57 pm, Michael Bayer [EMAIL PROTECTED] wrote: check for an _instance_key attribute. On Feb 12, 1:52 pm, Matt Culbreth [EMAIL PROTECTED] wrote: Hello Friends, I'm working with the latest version of SQLAlchemy now and I have a question: how do I