/NORM

NORM - No ORM framework

Primary LanguagePLpgSQLBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

What is NORM?

NORM stands for No ORM framework. NORM is not a PosgreSQL extention, not a library, and not a set of functions.

NORM is a methodology which allows object-oriented applications to interact with relational databases directly, without involving any ORM. Why do we want to avoid ORM? Because it negatively impacts application performance.

This meethodology was developed by Hettie Dombrovskaya and Boris Novikov and was fully impolemented at Braviant Holidings, Chicago IL.

What's in the repo?

The purpose of this repo is to provide a working example of the usage of NORM methodology.

TOC:

  • The doc directory contains: a list of publications on NORM and a ppt of the presentation from SOFSEM 2020 conference, where NORM was first officially announced.Take a look to find out why NORM was developed, and what are the advantages of this approach.
  • The sql directory contains a working example of NORM usage. Take a look to see to build PostgreSQL types and functions using NORM technology.
  • To install this example, run the _load.all file from the sql directory
  • See file sql\examples.sql for usage

Quick Start

Watch the video below from PostgresBuild2020 Conference, online

PostgresBuild 2020 recording

More on the NORM example

create_tables.sql creates three tables: account, phone and email and some lookiups.

initial_data_insert.sql does exactly what you think it does

array_transport.sql creates an array_transport funcion. That is the only function you need to save for future use, if you want to try the NORM approach in your company.

account_pkg.sql presents the NORM approach. In our approach, we combine the UDT definitions and corresponding functions into one file, which we call a package, referencing Oracle packages.

It includes types definitions, account_create function, account_search_by_id for simple search and account_search for complex search on the combination of criteria. The matching "select" functions convert the output into JSON converted to text for data transfer purposes.

Please refer to the presentation to learn why we are doing the transformation as a separate step.

Finally,the account_update function performs the update of complex object. In addition to update, it can also insert and delete detailed objects.

Note, that both insert and update functions also return new/modified object(s)