19.1.6. camcops_server.cc_modules.cc_blob¶
Copyright (C) 2012-2018 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CamCOPS.
CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.
-
class
camcops_server.cc_modules.cc_blob.
Blob
(**kwargs)[source]¶ Class representing a binary large object (BLOB).
Has helper functions for PNG image processing.
-
classmethod
get_contemporaneous_blob_by_client_info
(dbsession: sqlalchemy.orm.session.Session, device_id: int, clientpk: int, era: str, referrer_added_utc: pendulum.datetime.DateTime, referrer_removed_utc: Union[pendulum.datetime.DateTime, NoneType]) → Union[Blob, NoneType][source]¶ Returns a contemporaneous Blob object, or None.
Use particularly to look up BLOBs matching old task records.
-
classmethod
-
camcops_server.cc_modules.cc_blob.
blob_relationship
(classname: str, blob_id_col_attr_name: str, read_only: bool = True) → sqlalchemy.orm.relationships.RelationshipProperty[source]¶ Simplifies creation of BLOB relationships. In a class definition, use like this:
class Something(Base): photo_blobid = CamcopsColumn( "photo_blobid", Integer, is_blob_id_field=True, blob_field_xml_name="photo_blob" ) photo = blob_relationship("Something", "photo_blobid") # ... can't use Something directly as it's not yet been fully # defined, but we want the convenience of defining this # relationship here without the need to use metaclasses. # ... SQLAlchemy's primaryjoin uses Python-side names (class and # attribute), rather than SQL-side names (table and column), # at least for its fancier things: # http://docs.sqlalchemy.org/en/latest/orm/join_conditions.html#relationship-primaryjoin # noqa