palantir / palantir/foundry-platform-python

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

Open
#314 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
206
Forks
50
Avg merge
6d 3h
Merged PRs (30d)
3

Description

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(Integer, default=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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file, test, or entry point is identified; begin by clarifying whether this is a request for SDK documentation or guidance on modeling PostgreSQL inheritance in Foundry. Define the expected ontology behavior for Sample, DrySample, AntiSample, and ProteinSample before any contribution can be scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python, sqlalchemy
Domain
databases
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.