Skip to main content

Database Layer

The database layer (db) is a very thin layer that contains exactly how the data is stored in the underlying database system.

It involves concepts like:

  • Schema
  • Tables
  • Columns
  • Primary and foreign keys

Here is an example of a table definition in VKL:

db.postgres.movie_db.public {
table ORDERS {
identifier: "ORDERS"

column id {
primitive_type: "INTEGER"
identifier: "id"
is_primary_key: true
}

column customer_id {
primitive_type: "INTEGER"
identifier: "customer_id"
}

column customer_firstname {
primitive_type: "VARCHAR"
identifier: "customer_firstname"
}

column customer_lastname {
primitive_type: "VARCHAR"
identifier: "customer_lastname"
}

column country {
primitive_type: "VARCHAR"
identifier: "country"
}

column date {
primitive_type: "DATE"
identifier: "date"
}
...
}
}

The identifier is a SQL identifier, i.e. a column/table/schema/database name. These identifiers are used by Veezoo to generate SQL code.

Let's see what's next.