On 28Feb2022 10:11, Loris Bennett <loris.benn...@fu-berlin.de> wrote: >I have an SQLAlchemy class for an event: > > class UserEvent(Base): > __tablename__ = "user_events" > > id = Column('id', Integer, primary_key=True) > date = Column('date', Date, nullable=False) > uid = Column('gid', String(64), ForeignKey('users.uid'), nullable=False) > info = ?? > >The event may have arbitrary, but dict-like data associated with it, >which I want to add in the field 'info'. This data never needs to be >modified, once the event has been inserted into the DB. > >What type should the info field have? JSON, PickleType, String, or >something else?
I would use JSON, it expresses dicts well provided the dicts contain only basic types (strings, numbers, other dicts/lists of basic types recursively). I have personal problems with pickle because nonPython code can't read it. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list