Demo entry 2353113

test?

   

Submitted by Matt on Aug 11, 2015 at 16:51
Language: Python. Code size: 1.8 kB.

class MicrotiterPlates(Base):
    """Class maps to microtiter_plates"""
    __tablename__ = 'microtiter_plates'
    __table_args__ = {'schema': 'experiments', 'extend_existing': True}

    barcode = Column(String(255), primary_key=True)
    time_stamp = Column(DateTime, nullable=False,
            server_default=text(
                "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
                )
            )
    purchase_order_number = Column(String(255))
    client_id = Column(Integer, nullable=False)
    project_id = Column(Integer, nullable=False)
    experiment_set_id = Column(ForeignKey('experiments.experiment_sets.id',
                        ondelete='CASCADE',onupdate='CASCADE'),nullable=False)
    workflow_description_id = Column(ForeignKey(
        'experiments.workflow_descriptions.id'), index=True)
    protocol_id = Column(ForeignKey('experiments.protocols.id',
        ondelete=u'CASCADE', onupdate=u'CASCADE'),
        nullable=False, index=True)
    notes = Column(Text)

    workflow_description = relationship('WorkflowDescriptions',backref=backref('microtiter_plates'))
    experiment_set = relationship('ExperimentSets',backref=backref('microtiter_plates'))
    protocol = relationship("Protocols", backref=backref(
        "microtiter_plates"))
    #use the passive_deletes to let mysql handle the deletion cascade
    assay_data = relationship('AssayData', uselist=False, backref=backref(
        'microtiter_plates'), passive_deletes=True)
    data_analysis = relationship('DataAnalysis',backref=backref('microtiter_plates'),
        primaryjoin="MicrotiterPlates.barcode==DataAnalysis.barcode")
    plate_maps = relationship('PlateMaps',backref=('microtiter_plates'),passive_deletes=True)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).