[sqlalchemy] after_update event is fired when I save a many-to-many relationship

2022-12-23 Thread waters greg
I'm trying to update an audit log table called 'loggings', here is the definition of the corresponding model: class *Logging*(Base): __tablename__ = 'loggings' id = Column(GUID(), primary_key=True, nullable=False, default=uuid4) target_id = Column(GUID(), doc="The ID of the altered

Re: [sqlalchemy] How to format class property as another accessible property

2017-06-07 Thread Greg Silverman
Oh right, I've used the @property decorator before, just been a while. Thanks for the explanation of @hybrid_property. Makes sense. On Wed, Jun 7, 2017 at 5:32 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 06/07/2017 06:19 PM, Greg Silverman wrote: > >> Th

Re: [sqlalchemy] How to format class property as another accessible property

2017-06-07 Thread Greg Silverman
Thanks, it worked! I tried something similar using the @hybrid_property decorator, but could not get it to work. What exactly is the difference between that and the @property decorator? Greg-- On Wed, Jun 7, 2017 at 5:08 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > O

Re: [sqlalchemy] Re: How to format class property as another accessible property

2017-06-07 Thread Greg Silverman
Hi, Thanks for pointing that out. It's still throwing the same error, even when changed. Does not seem to like passing the column name to the column_property method. Greg-- On Wed, Jun 7, 2017 at 3:30 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote: > These are two different line

Re: [sqlalchemy] Grouped data in a Flask/SQLAlchemy class

2017-04-24 Thread Greg Silverman
Yes, I can certainly do that. Sounds pretty simple, actually. I may have more questions as I dive into this. Thanks! On Mon, Apr 24, 2017 at 3:06 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 04/24/2017 03:42 PM, Greg Silverman wrote: > >> My naive first

Re: [sqlalchemy] Grouped data in a Flask/SQLAlchemy class

2017-04-24 Thread Greg Silverman
, 2017 at 12:21 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 04/24/2017 12:51 PM, Greg Silverman wrote: > >> Hi Mike, >> I'm finally getting to this. Instead of having both a detail and grouped >> methods, I would like to have only the grouped m

Re: [sqlalchemy] Grouped data in a Flask/SQLAlchemy class

2017-04-24 Thread Greg Silverman
elaborate a bit how these would work within context of the class? Thanks! Greg-- On Wed, Mar 1, 2017 at 8:53 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 03/01/2017 08:27 PM, GMS wrote: > >> I have the following class models: >> >&g

Re: [sqlalchemy] Grouped data in a Flask/SQLAlchemy class

2017-03-02 Thread Greg Silverman
wrote: > > > On 03/01/2017 10:22 PM, Greg Silverman wrote: > >> >> >> On Wed, Mar 1, 2017 at 8:53 PM, mike bayer <mike...@zzzcomputing.com >> <mailto:mike...@zzzcomputing.com>> wrote: >> >> >> >> On 0

Re: [sqlalchemy] Grouped data in a Flask/SQLAlchemy class

2017-03-01 Thread Greg Silverman
d_list_of_diagnosis_detail): > > for (dx_code, patient_id), details in > itertools.groupby(sorted_list_of_diagnosisdetail, keyfunc): > diagnosis_group = DiagnosisGroup( >dx_code, patient_id > ) > diagnosis_group.details = de

Re: [sqlalchemy] Python datatime object issue with SQLite/SQLAlchemy

2016-11-11 Thread Greg M. Silverman
I should add: The specific queries I was running that were throwing the error all worked using your test case setup. Greg-- On Fri, Nov 11, 2016 at 10:50 AM, Greg M. Silverman <g...@grenzi.org> wrote: > Hi Mike, > Modifications of your test made to point to the actual databa

Re: [sqlalchemy] Python datatime object issue with SQLite/SQLAlchemy

2016-11-11 Thread Greg M. Silverman
. Interesting. Thanks! Greg-- On Thu, Nov 10, 2016 at 8:33 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 11/10/2016 08:10 PM, horcle_buzz wrote: > >> I am using SQLAlchemy and am having an issue wrt to an SQLite error: >> >> >> | >> SQLite

Re: [sqlalchemy] dealing with NULLS in 1-many relationships

2016-06-06 Thread Greg Silverman
Unfortunately, the data are out of our control. However, this solution looks like it will do the job. Thanks! Greg-- On Mon, Jun 6, 2016 at 5:54 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > On 06/06/2016 11:21 AM, Horcle wrote: > >> I have the following model

Re: [sqlalchemy] Re: Dynamically constructing joins

2015-03-25 Thread Greg Silverman
:]: query = query.join(eval(table), eval(criterion)) Where the variables table and criterion were built lists, so that I ended up doing a Cartesian product of all my tables, which was giving me many problems, with aliasing being the least of it! Thanks! Greg-- On Tue, Mar 24, 2015 at 11:22 PM, Jonathan

Re: [sqlalchemy] Issue with return results

2014-09-08 Thread Greg Silverman
Hi Jonathan, For the record, in my current setup, I installed python via Homebrew. Prior to that, I was using the Apple build of python, which would have been the 32-bit version that came with Lion. Greg-- On Mon, Sep 8, 2014 at 6:31 PM, Jonathan Vanasco jonat...@findmeon.com wrote: Looking

Re: [sqlalchemy] Issue with return results

2014-09-04 Thread Greg Silverman
I think I am going to dump SQL Server and just go with Postgres. Much easier, and less of a headache. Fortunately, we are not yet in production. Thanks! Greg-- On Thu, Sep 4, 2014 at 8:31 PM, Horcle g...@umn.edu wrote: Thanks. I forgot to mention that I had tried adding the encoding scheme

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Greg Silverman
SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' On Mon, Aug 18, 2014 at 9:47 AM, Horcle g...@umn.edu wrote: On Friday, August 15, 2014 8:28:41 PM UTC-5, Michael Bayer wrote: On Aug 15, 2014, at 5:03 PM, Greg

[sqlalchemy] sqlite string concats and datetime arithmetics

2013-08-29 Thread Greg Yang
I'm trying to get a series of datetimes using func.datetime. The format of input is func.datetime(basetime, '+ NNN seconds'), which works nicely if the shift applied is constant. However I need to add 10, 20, 30 seconds, etc to this base time. So I want something like func.datetime(basetime,

[sqlalchemy] unregister mapper event

2013-07-16 Thread Greg Yang
Is it possible to remove mapper events? Specifically I want to call event.remove(mapper, 'mapper_configured', fn) but I get an error back saying Mapper is not iterable. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this

[sqlalchemy] kivy and sqlalchemy

2013-07-10 Thread Greg Yang
I'm writing an application that uses kivy for GUI and sqlalchemy for ORM. Each has its own instrumentation system, and I initially planned to connect them by 1) mirroring relevant SA attributes in kivy at init, 2) work with only the kivy versions of the attributes for the duration of the app,

Re: [sqlalchemy] Strange behavior with a class inheriting from AssociationProxy

2013-07-09 Thread Greg Yang
= relationship('AB', collection_class=attribute_mapped_collection('a') ) @event.listens_for(A.ab, append) def append(target, value, initiator): value.b.ab[value.a] = value On Jul 8, 2013, at 9:07 PM, Greg Yang sorcer...@gmail.com javascript

[sqlalchemy] Strange behavior with a class inheriting from AssociationProxy

2013-07-08 Thread Greg Yang
I created a class CorrelatedProxy inheriting from AssociationProxy that allows the creator function to depend on the owner instance of the association proxy. Essentially it gets a attribute 'correlator' of the something like lambda x: lambda y, z: Constructor(x, y, z), and then intercepts the

Re: [sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-12 Thread Greg Yang
).options(joinedload(children)): for b in beta.children: assert b.id == beta.id assert b.a_re in beta.a_re.children On Jun 11, 2013, at 6:34 PM, Greg Yang sorcer...@gmail.com javascript: wrote: How would you use proxies? I can get B.a_re.children.b_re, but this includes

[sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-11 Thread Greg Yang
Consider these 2 mapped classes from sqlalchemy.engine import create_engine from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative.api import declarative_base from sqlalchemy.orm import relationship from sqlalchemy.orm.session import sessionmaker from

Re: [sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-11 Thread Greg Yang
, that represents all the intermediary rows. Might work, might not, would have to spend a few hours with it. Is there a reason you can't just route to the related B.a.children.bsusing proxies? Or a @property based loader? On Jun 11, 2013, at 4:45 PM, Greg Yang sorcer...@gmail.com

[sqlalchemy] Ordering by composite column gives sqlite3 OperationalError

2013-06-09 Thread Greg Yang
Right now query.order_by(composite) gives a sqlite3 operational error, because the rendered SQL is ORDER BY (composite_val1, composite_val2, composite_val3) instead of ORDER BY composite_val1, composite_val2, composite_val3. (The parenthesis is causing an error) For example, consider the code

Re: [sqlalchemy] AssociationProxy's behavior with == None seems unintuitive

2013-06-08 Thread Greg Yang
Awesome! The changes should be able to cover the issue. On Saturday, June 8, 2013 12:40:51 PM UTC-5, Michael Bayer wrote: On Jun 8, 2013, at 1:33 AM, Greg Yang sorcer...@gmail.com javascript: wrote: if __name__ == '__main__': engine = create_engine('sqlite:///:memory

[sqlalchemy] AssociationProxy's behavior with == None seems unintuitive

2013-06-07 Thread Greg Yang
Right now a filter clause AssociationProxy == None Consider the following code: from sqlalchemy.engine import create_engine from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative.api import declarative_base from sqlalchemy.orm import relationship from

[sqlalchemy] How to disable Foreign Keys to clear database

2012-08-16 Thread Greg
Hi, I was naively trying to clear a db earlier in the day and I ran into this problem: 'Cannot delete or update a parent row: a foreign key constraint fails' So as anyone would do I've been searching online and through the documentation on how to turn the foreign keys off, on delete =

[sqlalchemy] Re: Storing Nested Lists

2010-04-26 Thread greg
Excellent. Thanks very much. -- 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

[sqlalchemy] Storing Nested Lists

2010-04-25 Thread greg
Hi All, I'm new to sqlalchemy. I've been reading the documentation and group archives, but can't really find an answer to my question. I suspect it's a question of terminology, and that I don't really know the term for what I'm looking for. Can I map a nested list to one column, and have my

[sqlalchemy] Linking Tables using Reflection

2009-04-24 Thread greg
, engine, autoload_with=engine) B = Table('Table_B', metadate, engine, autoload_with=engine) Now, how do I go about creating a link, say A_id, from table 'B' to table 'A.id' Thanks for your help! --greg --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Reflection, Foreign Keys, Auto Defaults, Oh My!

2009-04-24 Thread greg
of this! --greg --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Reflection, Foreign Keys, Auto Defaults, Oh My!

2009-04-24 Thread greg
I just noticed that part of this has been answered yesterday. I apologize for the redundancy; I did not think I had posted the earlier request. --greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg
Yeah, I can get it to you, but in the reply box I'm not seeing anything here about attachments. There's just Send, Discard, Add Cc, or Edit Subject. I am set up to use this group only through the browser. On Jan 23, 12:35 pm, Don Dwiggins d...@dondwiggins.net wrote: Greg wrote: I think I

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg
Thanks, I'll try this out and let you know how it goes. On Jan 23, 12:43 pm, Rick Morrison rickmorri...@gmail.com wrote: Uh, did you guys not see my last message in this thread? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg
The commit mentioned earlier fixed the issue. Thanks for all the 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

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-22 Thread Greg
I think I found one that might help. Where can I upload this HTML file it generated? On Jan 22, 12:57 pm, Don Dwiggins d...@dondwiggins.net wrote: Greg wrote: Unfortunately, I'm connecting remotely via iODBC and do not have said tools. I'm running Ubuntu Linux, if you know of any way to get

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
, autoload_with=engine) On Jan 21, 1:14 am, Michael Bayer mike...@zzzcomputing.com wrote: yeah i meant send along the CREATE TABLE to the mailing list here.     or a describe, whatever shows us what column type might be failing. On Jan 20, 2009, at 9:45 PM, Greg wrote: How do I go about

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
As a disclaimer, this is a legacy system in which I have no control over, so what you are about to see is pretty disturbing :) http://pastebin.com/m10d49ac1 The formatting is pretty crazy, I'm hoping you can make use of this. --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
Unfortunately, I'm connecting remotely via iODBC and do not have said tools. I'm running Ubuntu Linux, if you know of any way to get the same thing prettied up, let me know and I will. On Jan 21, 12:22 pm, Don Dwiggins d...@dondwiggins.net wrote: Greg wrote: As a disclaimer, this is a legacy

[sqlalchemy] MSSQL Reflection Error

2009-01-20 Thread Greg
I've got the following code to reflect an MS SQL 8 database using the latest stable pyodbc, python 2.5, and SQLAlchemy 5.1: engine = create_engine('mssql://userXXX:pass...@mydsn', echo=False) meta = MetaData() meta.bind = engine artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg
like. On Jan 20, 2009, at 4:20 PM, Greg wrote: I've got the following code to reflect an MS SQL 8 database using the latest stable pyodbc, python 2.5, and SQLAlchemy 5.1: engine = create_engine('mssql://userXXX:pass...@mydsn', echo=False) meta = MetaData() meta.bind = engine artreqs

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg
How do I go about doing this? Showing the create table? On Jan 20, 4:54 pm, Rick Morrison rickmorri...@gmail.com wrote: I'm just trying to introspect an existing production database, not create any new tables. The structure of the table is read when reflecting the table: it's likely that

[sqlalchemy] problem with join, count on 0.5.0rc3

2008-11-08 Thread Greg
/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- py2.5.egg/sqlalchemy/orm/query.py, line 241, in _only_mapper_zero raise sa_exc.InvalidRequestError(This operation requires a Query against a single mapper.) InvalidRequestError: This operation requires a Query against a single mapper. Thanks. Greg

[sqlalchemy] Release posted on homepage!

2007-04-20 Thread Greg Copeland
I noticed current release information is now available on the SQLAlchemy homepage! Good job! Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Database Disconnection Detection

2007-04-02 Thread Greg Copeland
? If not, what exception will user code see? I found that various threads on automatic reconnection and I assume SA does not currently, reliably, support automatic database reconnection? Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Update Latest News on website?

2007-04-02 Thread Greg Copeland
Perhaps I missed it, but it would be great if you guys would update the Latest News section on the SA homepage when a new release is made available. Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Database Disconnection Detection

2007-04-02 Thread Greg Copeland
or something which has nothing to do with a psycopg2 operation...we're not sure if this is some artifact of native python extensions or what). Interesting. So there is no generic method for catching this category of error with SQLAlchemy right now, assuming the DBAPI actually returns an exception? Greg

[sqlalchemy] Re: Update Latest News on website?

2007-04-02 Thread Greg Copeland
. Just some food for thought. Greg On Apr 2, 12:33 pm, Michael Bayer [EMAIL PROTECTED] wrote: releases are announced on this mailing list as well as the Python cheeseshop (and all feeds which aggregate it, such as planet python). you can also subscribe to be a watcher on sourceforge where

[sqlalchemy] Re: Database Disconnection Detection

2007-04-02 Thread Greg Copeland
Frankly I'm very surprised this class of error has not been previously addressed. I'll have to test and see what happens. I was planning on doing the defensive coding, followed by the testing to make sure it is caught and recovers correctly. Greg On Apr 2, 12:36 pm, Paul Johnston [EMAIL

[sqlalchemy] Re: Database Disconnection Detection

2007-04-02 Thread Greg Copeland
. Application attempts to query database. What does SA return? In this case, it should know it does not have any connections within its pool. Is this documented? Is there any documention which describes the known failure modes which SA detects? If so, link please? Greg On Apr 2, 1:11 pm, Michael

[sqlalchemy] Re: Database Disconnection Detection

2007-04-02 Thread Greg Copeland
On Apr 2, 12:36 pm, Paul Johnston [EMAIL PROTECTED] wrote: Greg, If you can send the traceback you get when such an error occurs, that would be helpful for providing Oracle support for this condition. Paul I assume this means that the exception is not being caught and wrapped

[sqlalchemy] Re: Database Disconnection Detection

2007-04-02 Thread Greg Copeland
that later this week. My DB server is a shared server so shutting it down for the whole group is not well receieved. ;) Paul Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

[sqlalchemy] PyInstaller Support

2007-04-02 Thread Greg Copeland
imported. If you don't want to wait for the next release, search the google group and you'll find the proper hook file contents. Hope this isn't too much of a commercial. Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: PyInstaller Support

2007-04-02 Thread Greg Copeland
the author will be able to better address your questions/concerns. Greg On Apr 2, 6:02 pm, Michael Bayer [EMAIL PROTECTED] wrote: thats great. we are going to be checking in some code soon that will look for alternate database modules via pkg_resources...is that supported by PyInstaller also

[sqlalchemy] Re: memory leak with psyco

2007-03-21 Thread Greg Copeland
could test this by driving your application with a set of fixed inputs. One of the gotchas of using psyco is memory use goes through the roof in exchange for much improved performance. Greg On Mar 21, 10:49 am, Andrew Stromnov [EMAIL PROTECTED] wrote: Using psyco (with full() optimization

[sqlalchemy] Re: Functions with out parameters?

2007-03-09 Thread Greg Copeland
Great that's working. And Yuck! Having to do that directly on the cursor really makes me enjoy SA's capabilities. Can't wait until that's a supported feature. Keep up the good work guys! Greg On Mar 9, 10:42 am, Michael Bayer [EMAIL PROTECTED] wrote: you can pull raw_connection() off

[sqlalchemy] Functions with out parameters?

2007-03-08 Thread Greg Copeland
function via the func method, which also has output parameters? Are they even supported? Function blah looks something like: create or replace function blah( arg1 IN VARCHAR2(15), arg2 IN INTEGER, arg3 IN INTEGER, arg4 OUT NOCOPY VARCHAR2 ) RETURN INTEGER ... Greg