EarthCubeGeochron / Sparrow

A software tool and schema+API spec for connecting laboratory measurements to data consumers
https://sparrow-data.org
Mozilla Public License 2.0
14 stars 4 forks source link

Easy data querying from SQL #299

Open davenquinn opened 2 years ago

davenquinn commented 2 years ago

We need easier ways to query the database without doing a ton of joins.

Something like this, but for datums and attributes.

--CREATE OR REPLACE VIEW sparrow_views.all_data AS
SELECT
  *
FROM datum d
JOIN datum_type dt
  ON dt.id = d.type
JOIN analysis a
  ON a.id = d.analysis
JOIN session s
  ON s.id = a.session_id
JOIN sample sa
  ON sa.id = s.sample_id
JOIN sample_researcher sr
  ON sr.sample_id = s.id
JOIN researcher r
  ON r.id = sr.researcher_id;
-- Also want attributes