Skip to content

[consult] How to build ontology in case of postgresql where table inherit exist #314

@littleDrew

Description

@littleDrew

Here in our case, we need to build ontology based on tables in postgresql databse.

  • There are multi table in database, and they have inherit relation(as postgresql support this), i use sqlalchemy to describe these part of table as follows, here include base table like Sample, and inherited table like DrySample; and there are futher inherited table like AntiSample and ProteinSample which inherited from DrySample.

  • In these case, how should i build ontology in palantir? I thought palantir not support object type inherit, am i right ? hoping for your kindly help and reply @jsmith @jameszhang244 @afloren-palantir @invliD @ericanderson @jmcampanini @akerl @tdeitch

class Sample(Base):

    __tablename__ ='samples'

    id: Mapped[int] = mapped_column(primary_key=True)
    source: Mapped[int] = mapped_column(ForeignKey('experiments.id'))
    type: Mapped[str] = mapped_column(String(255))


class DrySample(Sample):
    __tablename__ = 'dry_samples'
     id: Mapped[int] =  mapped_column(ForeignKey('samples.id'), primary_key=True)
     sample_id: Mapped[str] = mapped_column(String(255))
      freeze_count: Mapped[int] = mapped_column(Integerdefault=0)

class AntiSample(DrySample):
     __tablename__ = 'anti_samples'
     id: Mapped[int] =  mapped_column(ForeignKey('dry_sample.id'), primary_key=True)
     volume: Mapped[str] = mapped_column(Float)

class ProteinSample(DrySample):
     __tablename__ = 'anti_samples'
     id: Mapped[int] =  mapped_column(ForeignKey('dry_sample.id'), primary_key=True)
     protein_id: Mapped[int] = mapped_column(ForeignKey('proteins.id'))
     description: Mapped[str] = mapped_column(Text)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions