An open API service indexing awesome lists of open source software.

https://github.com/lyrasis/collectionspace-sql

Notes on and examples of SQL for working with CollectionSpace data
https://github.com/lyrasis/collectionspace-sql

collectionspace postgresql sql

Last synced: 5 months ago
JSON representation

Notes on and examples of SQL for working with CollectionSpace data

Awesome Lists containing this project

README

          

:toc:
:toc-placement!:
:toclevels: 4

= CollectionSpace SQL

A place to record tips for working with CollectionSpace data directly in the PostgreSql database

toc::[]

== Conventions

Client-identifying info has been removed from SQL examples and replaced with the following patterns:

`{INSTANCEDOMAIN}` replaces values like `core.collectionspace.org` or `collectionspace.clientdomain.org` in refname values or elsewhere

[source,sql]
----
CAST(E'urn:cspace:{INSTANCEDOMAIN}:vocabularies:name(publishto):item:name(all)\'All\'' AS text) AS item
----

== Contents
* https://github.com/lyrasis/collectionspace-sql/blob/main/getting_into_database.adoc[Getting into the databases]
* https://github.com/lyrasis/collectionspace-sql/blob/main/common_patterns.adoc[Common patterns/snippets] - excluding deleted records, how to find data for a given record from the application UI, etc
* https://github.com/lyrasis/collectionspace-sql/blob/main/functions.adoc[Functions] - reusable bits
* https://github.com/lyrasis/collectionspace-sql/blob/main/data_projects.adoc[Data projects] - queries to support actual work

== Other resources
* Nuxeo database documentation: https://doc.nuxeo.com/nxdoc/internal-vcs-model/[Internal VCS Model] -- https://doc.nuxeo.com/nxdoc/vcs-tables/[VCS tables]
* Some example JasperReports have embedded PGSQL queries to crib from:
** https://github.com/collectionspace/services/tree/master/services/report/3rdparty/jasper-cs-report/src/main/resources[standard reports]
** https://github.com/lyrasis/cspace-deployer/tree/master/docker/dts/production/mcgill/reports[mcgill]
** https://github.com/lyrasis/cspace-deployer/tree/master/docker/dts/production/ohc/reports[ohc]