This is a repository to store the functions used within the Neotoma Database for data access and updates. The Neotoma is a Postgres-based system, migrated from a SQL Server database. As such, at the current time, this repository largely reflects the state of transition between the two systems.
All individuals are welcome to contribute to this repository. Contributions are subject to the Code of Conduct for this repository.
- Steve Crawford - Penn State
- Simon Goring - University of Wisconsin
- Mike Stryker - Penn State
- Anna George - University of Wisconsin
- Jack Williams - University of Wisconsin
The repository is divided into two main folders, legacy and function:
legacyfolder is intended to act as the store for the now deprecated SQL Server Stored Procedures.functionfolder represents the newer Postgres functions. This folder is then divided into folders for each individual database schema.
This structure is not necessary, but has been implemented to help manage the workflow of rewriting the large number of functions associated with the original database.
There are several files that have been used in the transition and are included here for posterity.
rewrite_funs.Ris a short R script that was intended to rewrite any function in the legacyTIschema that used the formatSELECT * FROM table.tilia_check.pywas intended to check against existing functions in thetinamespace to help ensure alignment with the Tilia software package designed to work with the Neotoma Paleoecology Database.
This repository is currently intended to be read-only. The stored postgres functions can be updated using the Python3 script connect_remote.py by calling:
python3 connect_remote.pyThis program checks the pg_catalog and pulls each function within a defined set of namespaces, and returns each function as its own sql file to a folder in the function directory.
Functions are expected to follow (as much as possible) Simon Holywell's SQL Style Guide and the Postgres Coding Convention.
- Functions should be generated in standalone files
- Functions should be named using verbs
- Functions should refrain from using vendor specific functions
- Use C style commenting: /* . . . */
For more insight into the structure of the Neotoma Database (specifically the ndb schema, which contains the core data of the database), visit the Neotoma Database Documentation. Documentation was generated using the SchemaSpy software.
Please feel free to raise issues using the issue tracker on this repository.