Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-20 Thread Jonathan Vanasco
sorry. i'm getting over a code and in my fever-dream state thought I was making something clear with an analogy. looking at this, and literally everything else I wrote yesterday, I'm amazed it's at least in english. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-20 Thread TazMainiac
On Fri, Oct 20, 2017 at 3:58 AM, Simon King wrote: > This is a subtle python gotcha based on how the import system works. > It doesn't have anything to do with SQLAlchemy. > >

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-20 Thread Simon King
On Thu, Oct 19, 2017 at 9:10 PM, TazMainiac wrote: > > > On Thu, Oct 19, 2017 at 2:25 PM, Jonathan Vanasco > wrote: >> >> On Thursday, October 19, 2017 at 11:55:49 AM UTC-4, Taz Mainiac wrote: >>> >>> So - a morning spent googling does not turn up any

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-19 Thread Mike Bayer
It's not different "processes". It's the difference between running myfile.py from the python interpreter, making the module effectively __main__, vs running myfile.py via "import myfile". Same filesystem file but two totally different modules in the same process. On Oct 19, 2017 4:29 PM,

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-19 Thread Jonathan Vanasco
On Thursday, October 19, 2017 at 4:10:11 PM UTC-4, Taz Mainiac wrote: > > > If you ran two scripts or two modules, it would also almost always fail >> (IIRC, it is remotely possible but highly unlikely, to generate the same id >> in another process). >> > > I am not doing that. > > re-read

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-19 Thread TazMainiac
On Thu, Oct 19, 2017 at 2:25 PM, Jonathan Vanasco wrote: > On Thursday, October 19, 2017 at 11:55:49 AM UTC-4, Taz Mainiac wrote: >> >> So - a morning spent googling does not turn up any information about >> Python classes having a different id depending on context (script

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-19 Thread Jonathan Vanasco
On Thursday, October 19, 2017 at 11:55:49 AM UTC-4, Taz Mainiac wrote: > > So - a morning spent googling does not turn up any information about > Python classes having a different id depending on context (script vs > module). I'm probably not googling for the right thing? Can anyone point >

Re: [sqlalchemy] SQLAlchemy enum in external file

2017-10-19 Thread TazMainiac
On Wed, Oct 18, 2017 at 9:08 PM, Mike Bayer wrote: > the example calls the "myoper" python file in two different contexts, > resulting in two different MyStatus enumeration objects. Calling > "python myoper.py" invokes "myoper" as a plain Python script, sets up >

[sqlalchemy] SQLAlchemy enum in external file

2017-10-18 Thread Taz Mainiac
I have Postgres DB with a table of pending operations. One column in the operation in an enum with the status of the enum. I used the standard python (2.7) enum, with AutoNumber (myenum.py): class AutoNumber(enum.Enum): def __new__(cls): value = len(cls.__members__) + 1