2023-08-05 23:58:38 +03:00
# SYSTEM VIEWS
2023-08-06 20:40:06 +03:00
Views on database schema metadata available in every database.
2023-08-05 23:58:38 +03:00
## sys.sys.databases
Only available in database "sys".
2024-08-28 22:42:38 +03:00
This is the only query in Obelisk that is not idempotent. This is because dropping a database results in clearing all references to that database on the server.
2023-08-05 23:58:38 +03:00
### Columns
**database @tas ** Database name.
2024-01-22 00:50:35 +03:00
**sys-agent @tas ** Agent responsible for the latest database schema state.
2023-08-05 23:58:38 +03:00
**sys-tmsp @da ** Timestamp of latest database schema state.
2024-01-22 00:50:35 +03:00
**data-ship @p ** Ship making the latest database user data state
2023-08-05 23:58:38 +03:00
2024-01-22 00:50:35 +03:00
**data-agent @tas ** Agent responsible for the latest user data state.
2023-08-05 23:58:38 +03:00
**data-tmsp @da ** Timestamp of latest user data state.
### Default Ordering
database, sys-tmsp, data-tmsp
## sys.namespaces
Available in every database except "sys".
### Columns
**namespace @tas ** Namespace name.
**tmsp @da ** Namespace creation timestamp.
### Default Ordering
2024-07-22 18:33:07 +03:00
tmsp, namespace
2023-08-05 23:58:38 +03:00
## sys.tables
### Columns
**namespace @tas ** Namespace of table.
**name @tas ** Table name.
2024-01-22 00:50:35 +03:00
**ship @p ** Ship making the latest table state change.
2023-08-05 23:58:38 +03:00
2024-01-22 00:50:35 +03:00
**agent @tas ** Agent responsible for the latest table state change.
2023-08-05 23:58:38 +03:00
**tmsp @da ** Timestamp of latest table state change.
**row-count @ud ** Count of rows in table.
**key-ordinal @ud ** Ordinal of column in primary key.
**key @tas ** Column in primary key.
2024-01-22 00:50:35 +03:00
**key-ascending @f ** Indicates whether the column in the primary key is ascending or descending
2023-08-05 23:58:38 +03:00
### Default Ordering
2024-07-22 18:33:07 +03:00
namespace, name, key-ordinal
2023-08-05 23:58:38 +03:00
## sys.columns
### Columns
2024-01-22 00:50:35 +03:00
**namespace @tas ** Namespace of the table.
2023-08-05 23:58:38 +03:00
**name @tas ** Table name.
**col-ordinal @ud ** Ordinal of column in table's canonical ordering.
**col-name @tas ** Name of column.
2024-07-22 18:33:07 +03:00
**col-type @ta ** Aura type of column.
2023-08-05 23:58:38 +03:00
### Default Ordering
namespace, name, col-ordinal
2023-08-06 20:40:06 +03:00
## sys.sys-log
2024-07-22 18:33:07 +03:00
This view records the times and events effecting the current state of the database schema.
2024-09-02 03:48:36 +03:00
2024-07-22 18:33:07 +03:00
DROPs are not recorded.
2023-08-06 20:40:06 +03:00
### Columns
**tmsp @da ** Timestamp of database schema change of state.
2024-01-22 00:50:35 +03:00
**agent @tas ** Agent responsible for the state change.
2023-08-06 20:40:06 +03:00
2024-01-22 00:50:35 +03:00
**component @tas ** (To do: 2 columns, component and namespace along with view rewrite)
2023-08-06 20:40:06 +03:00
**name @tas ** Added or altered component.
### Default Ordering
tmsp descending, component, name
## sys.data-log
2024-07-22 18:33:07 +03:00
This view records the times and events effecting the current state of the database data.
2023-08-06 20:40:06 +03:00
### Columns
**tmsp @da ** Timestamp of table data change of state.
2024-01-22 00:50:35 +03:00
**ship @p ** Ship making the state change.
2023-08-06 20:40:06 +03:00
2024-01-22 00:50:35 +03:00
**agent @tas ** Agent responsible for the state change.
2023-08-06 20:40:06 +03:00
**namespace @tas ** Table namespace.
**table @tas ** Table name.
2024-09-02 03:48:36 +03:00
**row-count @ud ** Count of rows in table.
2023-08-06 20:40:06 +03:00
### Default Ordering
tmsp descending, namespace, table
2024-07-22 18:33:07 +03:00
## sys.view-cache
To do: list caches & populated/not populated
### Columns
**namespace @tas ** Namespace of the view.
**name @tas ** View name.
...