Re: [sqlalchemy] Custom JSON type that acts as a numpy array on Python side

2018-08-30 Thread Ruben Di Battista
Ok, thank you for the fast answer as always. Moreover the specs for the JSON datatype for MySQL say: A JSON column cannot have a default value. So I think I will just skip the default value. Thank you by the way again! _ -. .´ | ', ;|∞∞ ˜˜ |∞ RdB

Re: [sqlalchemy] Custom JSON type that acts as a numpy array on Python side

2018-08-30 Thread Mike Bayer
On Thu, Aug 30, 2018 at 6:32 AM, Ruben Di Battista wrote: > Ehi Mike, thank you :). > > I just went ahead in implementing a custom type for a Python object that is > a (subclass of) numpy array and that is stored as JSON in the DB. > > This is the Python class: > > class ElevationMask(np.ndarray):

Re: [sqlalchemy] Custom JSON type that acts as a numpy array on Python side

2018-08-30 Thread Ruben Di Battista
Ehi Mike, thank you :). I just went ahead in implementing a custom type for a Python object that is a (subclass of) numpy array and that is stored as JSON in the DB. This is the Python class: class ElevationMask(np.ndarray): r""" A class to represent an elevation mask. This class proxi

Re: [sqlalchemy] Custom JSON type that acts as a numpy array on Python side

2018-07-23 Thread Mike Bayer
On Mon, Jul 23, 2018 at 1:28 PM, Ruben Di Battista wrote: > Hello, > I need to store a matrix into the database and I was evaluating the > possibility to have a column of JSON type in MySQL to store it. What I would > like to achieve is the possibility of operating on a numpy array when > manipula

[sqlalchemy] Custom JSON type that acts as a numpy array on Python side

2018-07-23 Thread Ruben Di Battista
Hello, I need to store a matrix into the database and I was evaluating the possibility to have a column of JSON type in MySQL to store it. What I would like to achieve is the possibility of operating on a numpy array when manipulating that column on Python while keeping a "meaningful" data type