[sqlalchemy] Query filter like with wildcards not working with custom type

2011-03-29 Thread Stephen
for .like('foobar') then I will get the row returned as expected. Lastly, I'm on v0.5.1 (way behind I know!). Any thoughts? Thanks so much, Stephen -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group

[sqlalchemy] Re: Query filter like with wildcards not working with custom type

2011-03-29 Thread Stephen
tual encryption/decryption is handled by hitting a remote RESTful service so I'm not sure I could do that on the DB side as you mention. This functionality isn't mission critical so I may just have to remove it from my application. Thanks for your input though! On Mar 29, 7:55 am, Michael Ba

[sqlalchemy] v0.5.1 Memcache Query

2011-05-04 Thread Stephen
realize I didn't provide much code and can provide a more complete class definition if that helps. Stephen -- 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 un

[sqlalchemy] Re: v0.5.1 Memcache Query

2011-05-05 Thread Stephen
l? If you're as confused as I am I may try to upgrade to 0.6 instead :) On May 5, 6:52 am, Michael Bayer wrote: > On May 4, 2011, at 8:51 PM, Stephen wrote: > > > > > > > > > > > Hi there, > > > I am on an older version of SQLAlchemy (0.5.1) an

[sqlalchemy] Re: v0.5.1 Memcache Query

2011-05-05 Thread Stephen
his thread with more details questions in the future! On May 5, 10:24 am, Stephen wrote: > Thanks so much for your quick response! You're awesome. > > Caching is done conditionally at least by object because each model > class must set a flag on its __mapper__ to True (otherwise cachi

[sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen
27;t understand how to take advantage of this through the sqlalchemy api. Is the only way to get this through: scoped_session(..).connection(...).execute("sql command") Thanks, Stephen -- You received this message because you are subscribed to the Google Groups "sqlalchemy"

[sqlalchemy] Model class creation and configure_mapper performance

2018-03-08 Thread stephen
Hi, Our team has been intensively using SQLAlchemy for five years now. Over the years, we've accumulated a large number of models (roughly 350). Over time, our app start-up has also slowed quite a bit. This has some negative effects since it's tied to several dev processes like starting up a s

Re: [sqlalchemy] Model class creation and configure_mapper performance

2018-03-12 Thread stephen
Ah, I see. That makes sense. Thanks for the thorough response! We will look elsewhere to improve our app startup time for now. > 300 classes shouldn't be a 9 second operation. It's 9s running with the profiling overhead. In reality, setup_mapping and configure_mappers are closer to 2.5s each.

[sqlalchemy] How can I distinguish between INSERT, UPDATE, and DELETE in after_flush?

2015-01-17 Thread Stephen Fuhry
I'm trying to build a relatively unsophisticated audit trail table that simply logs INSERTS, UPDATES, and DELETEs to certain models. The idea is to be able to merely throw an attribute MyModel.__store_changes__ = True on a declarative model, and let a generic SessionExtension handle the rest. I

Re: [sqlalchemy] How can I distinguish between INSERT, UPDATE, and DELETE in after_flush?

2015-01-18 Thread Stephen Fuhry
.new > were INSERTs and those that were in .dirty would be UPDATES. > > Stephen Fuhry > wrote: > > > I'm trying to build a relatively unsophisticated audit trail table that > simply logs INSERTS, UPDATES, and DELETEs to certain models. The idea is to > be able to

[sqlalchemy] Calling Stored Procedure in MySQL with output parameter

2013-04-18 Thread Stephen Ray
han a MySQL Stored Procedure. Thanks in advance. Stephen Ray -- 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.

Re: [sqlalchemy] Calling Stored Procedure in MySQL with output parameter

2013-04-18 Thread Stephen Ray
bably need to use the DBAPI connection directly from an Engine or a > Connection and then manipulate the cursor directly. > > > On Apr 18, 2013, at 9:18 AM, Stephen Ray > > wrote: > > My environment is Python 3.2, SQLAlchemy 0.8, MySQL 5.5, and using > MySQL-connecto

Re: [sqlalchemy] Calling Stored Procedure in MySQL with output parameter

2013-04-18 Thread Stephen Ray
rned result set. Thanks for your help! Steve R On Thursday, April 18, 2013 1:09:39 PM UTC-4, Michael Bayer wrote: > yeah I've no idea, would need to get it working with raw cursor first to > even know how this should be treated. > > > On Apr 18, 2013, at 10:43 AM, Step

[sqlalchemy] multiple columns in correlated subquery?

2011-05-31 Thread Stephen Emslie
In Oracle, I would like to perform a correlated subquery where multiple columns are specified in the set clause and those columns are selected by the subquery. For example: UPDATE table1 a SET (a.column1, a.column2) = (SELECT b.column1, b.column2 FROM table2 b WHERE a.id=b.id) WHERE a.group=:group

[sqlalchemy] AttributeError: 'str' object has no attribute 'decode' (Python 3.2 and SQL Server 2008R2)

2013-01-09 Thread Stephen Ray
My envirionment is SQLAlchemy 0.7.9, pyodbc 3.0.2, Python 3.2, and SQL Server 2008 R2 running on Windows 7 I have the following Python (details of the connection url removed - the connection to the db succeeds): from sqlalchemy import create_engine, MetaData, Table engine = create_engine(dbur

[sqlalchemy] Tracking Last Update timestamp for models

2009-08-24 Thread Stephen Hansen
Hi all. I'm working on converting our system to use SQLAlchemy, and one thing I'm not sure how to do properly is to track when a particular model object is last updated. When doing just raw SQL over the DB-API, this basically meant whenever I did a change to the model, I would issue an UPDATE state

Re: [sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen Mullins
y. On Fri, Jan 15, 2010 at 11:38 AM, Michael Bayer wrote: > Stephen wrote: > > I didn't see anything in the docs or in this group so please forgive > > me if this has been asked already. > > > > If I'm using sqlalchemy with an underlying mysql db, how

Re: [sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen Mullins
Oh ok that makes sense and I can easily use this. Thank you! On Fri, Jan 15, 2010 at 2:03 PM, Michael Bayer wrote: > Stephen Mullins wrote: > > Cool thank you. I take it that means there's no way to do this if I'm > just > > using a Base model and a session. &

[sqlalchemy] Re: Cascading delete

2008-08-21 Thread stephen emslie
Hi Bob Looks like you're doing some fun thinking :) Steve On Thu, Aug 21, 2008 at 11:04 AM, Bob Farrell <[EMAIL PROTECTED]> wrote: > Hi there, > > I spoke with zzzeek_ on IRC yesterday re: some code I'd written for an > introspective cascading delete function. We were previously using the ORM t

[sqlalchemy] Many-to-many, same table, association objects.

2009-02-13 Thread Stephen Hansen
ForeignKey(dbAsset.c.id, ondelete="NO ACTION"), key='destination'), sql.Column("link_type", sql.String(100), key='type', nullable=False, default=''), ) Just how to configure the mappers has be sa bit lost at this point. Any pointers? Thanks for

[sqlalchemy] Re: Many-to-many, same table, association objects.

2009-02-13 Thread Stephen Hansen
> The first step would be to configure the inheritance hiearchy of > Things, as I see you have an Asset table in there as well which I'm > assuming is a Thing subclass. The joined table inheritance section > in the docs will explain that. then you just set up relations using > the same techniqu

[sqlalchemy] Re: Self Join via Join Table ?

2009-02-25 Thread Stephen Telford
Hello Az, Yes, Bar is the association table of Foo to Foo. In essence, this is a self join through a join table.. I have tried and hit my head on this for (quite literally) hours. In the end, and for the record, I ended up creating a method on the model itself such as ; def children(self):

[sqlalchemy] Re: Self Join via Join Table ?

2009-02-25 Thread Stephen Telford
tion object. it will ultimately use Foo/Bar for > querying but attribute access would be proxied through the names you > confgure. > > > On Feb 25, 2009, at 4:11 PM, Stephen Telford wrote: > > Hello Az, > Yes, Bar is the association table of Foo to Foo. In essence, thi

[sqlalchemy] Re: Self Join via Join Table ?

2009-02-25 Thread Stephen Telford
umn(Integer, primary_key=True) > > bar_table = Table('bar', Base.metadata, >Column('parent_id', Integer, ForeignKey('foo.id'), nullable=False), >Column('child_id', Integer, ForeignKey('foo.id'), nullable=False)) > > Foo.chi

[sqlalchemy] Re: Self Join via Join Table ?

2009-02-25 Thread Stephen Telford
and of course, both the passwords -are- the same (duh ;) .. the 'get()' works fine (obviously ;) Regards Stef On Wed, Feb 25, 2009 at 7:53 PM, Stephen Telford wrote: > Thank you Bobby!! That does make things more easier, and it shows then that > I am being a -real- moron

[sqlalchemy] Re: SQLAlchemy Migrate

2009-03-06 Thread Stephen Emslie
It is always good to see some activity on this front. sqlalchemy-migrate seems to be a good idea that needs more activity. Perhaps try contributing to that project before branching. Any comment from the sqlalchemy-migrate developers? Stephen On Fri, Mar 6, 2009 at 3:13 PM, J. Cliff Dyer

[sqlalchemy] Re: How to map columns into a tuple using SQLAlchemy?

2009-03-13 Thread Stephen Emslie
You could try changing your _limit tuple to a property on the class that returns the tuple you want. For example: class Result(object): def get_limit(self): return (self.upper, self.lower, self.nominal) _limit = property(get_limit) Is this what you were looking for? Stephen Emslie

[sqlalchemy] Re: getting the number of records in a result set from select

2009-03-13 Thread Stephen Emslie
Well, I would have expected ResultProxy.rowcount to do just that (return the number of rows in the last executed statement) but I just get 0 from it. Perhaps someone could explain how to use it correctly. Stephen Emslie On Thu, Mar 12, 2009 at 5:20 PM, jeff wrote: > > hi. this question

[sqlalchemy] Overriding reflected columns in SqlSoup?

2009-04-25 Thread Stephen Emslie
ined When reflecting tables directly with sqlalchemy, using Table(name, meta, autoload=True), one can override the reflected columns to compensate for the lack of a primary key. Is this possible in SqlSoup? Stephen Emslie --~--~-~--~~~---~--~~ You received th

[sqlalchemy] Re: Overriding reflected columns in SqlSoup?

2009-04-28 Thread Stephen Emslie
nd it easier at that point just to skip SqlSoup and define the table metadata and mapping myself. I hope that helps. Stephen Emslie On Sun, Apr 26, 2009 at 11:48 PM, NeilK wrote: > Hi Stephen, did you find a way to access those tables without a > primary key using SqlSoup? > > Th

[sqlalchemy] adjacency list: filtering relations eagerly

2007-08-20 Thread stephen emslie
part of the original join rather than all of parent_instance's children. Is something like this possible? The closet that I've found is using add_entity after each join in my query. Thanks Stephen --~--~-~--~~~---~--~~ You received this message because yo

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-08-22 Thread stephen emslie
-query version I have working now so its worth investigating. > I'd be curious though if you could play around a little with > the approach I just suggested to see if its at all workable ? Definitely. I dont actually understand it yet, but I'll report back on what I find. Thanks fo

[sqlalchemy] between_op() error with property expressions: is this a bug?

2007-08-23 Thread stephen emslie
ssion here? MappedClass.c.age.between(1,2) behaves normally. Stephen Emslie --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-08-31 Thread stephen emslie
I should probably mention that I set lazy=False on the children relation in that example before this behavior worked. Stephen Emslie On 8/31/07, stephen emslie <[EMAIL PROTECTED]> wrote: > On 8/20/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > I'd be curious though

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-08-31 Thread stephen emslie
> would automatically add the columns to the Query's SELECT statement > without needing to construct your from_statement() like we're doing > above. This would certainly neaten things up :) Stephen Emslie --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-09-04 Thread stephen emslie
#x27; relation coming up with subnode2 rather than node2 (i.e. skipping the first relation), but its nice to know I wasn't completely off that mark :) Stephen Emslie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-09-11 Thread stephen emslie
ance improvement. Using contains_eager would allow me to cut down significantly on the number of requests I'm performing. Thanks for the help! Stephen Emslie On 9/4/07, stephen emslie <[EMAIL PROTECTED]> wrote: > > im going to play with this a little bit, but my first instinct is > &g

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-10-09 Thread stephen emslie
ial mappers (the alias of the last contains_eager statement to be issued ends up as the only 'children' relation in the result) Any idea whether this is a bug or expected behavior? I could try to rustle up a test script if it would help. Stephen Emslie On 9/11/07, stephen emslie <[EMAIL

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-10-09 Thread stephen emslie
Thanks for the quick response. Looking forward to the refactoring :) Stephen Emslie On 10/9/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > On Oct 9, 2007, at 10:18 AM, stephen emslie wrote: > > > > > Hi. I've been quiet on this for a while. I'm gett

[sqlalchemy] path based options and contains_eager

2007-11-16 Thread stephen emslie
children.children', alias=ali2)).one() Traceback (most recent call last): File "basic_tree.py", line 88, in root = query.options(contains_eager('children', alias=ali), contains_eager('children.children', alias=ali2)).one() File "/home/stephen/src/sqlalchemy/l

[sqlalchemy] Re: path based options and contains_eager

2007-11-18 Thread stephen emslie
that might actually be the correct behaviour here. Stephen Emslie On Nov 18, 2007 4:20 PM, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > On Nov 16, 2007, at 12:29 PM, stephen emslie wrote: > > > > > > > > > I'm a bit confused now, so please tell m

[sqlalchemy] Analogue of SQL view in SqlAlchemy

2017-01-13 Thread Stephen Davies
(Using latest SqlAlchemy with either sqlite or postgres on a Flask server) I have a table of entities and stats with columns: id, date, stat1, stat2, etc. There are a lot of endpoints on the Flask server that need to do processing on an aggregated form of the above, something like: SELECT id, d

Re: [sqlalchemy] Analogue of SQL view in SqlAlchemy

2017-01-21 Thread Stephen Davies
Thanks Mike. That approach is working well. On Sunday, 15 January 2017 03:48:19 UTC+11, Mike Bayer wrote: > > > > On 01/13/2017 11:13 PM, Stephen Davies wrote: > > (Using latest SqlAlchemy with either sqlite or postgres on a Flask > server) > > > > I have a

[sqlalchemy] Problem with undefer_group

2017-08-20 Thread Stephen Early
Item class after it's defined, as follows: StockItem.used = column_property( select([func.coalesce(func.sum(StockOut.qty), text("0.0"))]).\ correlate(StockItem.__table__).\ where(StockOut.stockid == StockItem.id).\ label('used'), deferred=True, g

Re: [sqlalchemy] Problem with undefer_group

2017-08-20 Thread Stephen Early
items[0].used, d.items[0].remaining)) print("\n\n\n\nTrying with separate undefer() calls...") # I expect this query to complete in one round-trip to the database, # and it does. s = sm() d = s.query(Delivery).\ filter_by(id=d_id).\ options(joinedload("items")).\

Re: [sqlalchemy] Problem with undefer_group

2017-08-24 Thread Stephen Early
That's an amazingly quick response! Thank you very much. Stephen Early On Thursday, 24 August 2017 16:02:41 UTC+1, Mike Bayer wrote: > > Alrighty I got that other case working, the issue is resolved and will > be in the next 1.1 release which is 1.1.14. > > On Wed, Aug

[sqlalchemy] Proposed improved API for query_expression

2018-06-07 Thread Stephen Fuhry
Hi there! I'd like to propose an idea for an enhancement to the query_expression API. I have found query_expression feature (introduced in 1.2) extremely useful, however its current API is rather awkward and lacks any sort of conventional organizational patterns for more common, albeit advanced