Unless you need to use all the readings immediately, have you considered
just making a custom def under the Sensor model, and then inserting all the
readings via sqlalchemy core? That would allow you to insert them without
creating ORM objects, which people using numpy and a lot of data often like
to avoid.
Then you could do...
s = Sensor()
session.add(s)
session.add_readings(dates, voltages, values)
it would look something like this...
class Sensor(Base):
def add_readings(self, dates, voltages, values):
if not self.id:
# flush this to the session
session = object_session(self)
session.flush(objects=[self])
# insert via core
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.