The dm
class holds a list of tables and their relationships.
It is inspired by datamodelr,
and extends the idea by offering operations to access the data in the tables.
dm()
creates a dm
object from one or multiple tbl objects
(tibbles or lazy data objects).
dm_from_src()
creates a dm
from some or all tables in a src
(a database or an environment).
new_dm()
is a low-level constructor that creates a new dm
object.
If called without arguments, it will create an empty dm
.
If called with arguments, no validation checks will be made to ascertain that
the inputs are of the expected class and internally consistent;
use validate_dm()
to double-check the returned object.
validate_dm()
checks the internal consistency of a dm
object.
cdm_get_src()
returns the dplyr source for a dm
object.
All tables in a dm
object must be from the same source,
i.e. either they are all data frames, or they all are stored on the same
database.
cdm_get_con()
returns the DBI::DBIConnection
for dm
objects.
This works only if the tables are stored on a database, otherwise an error
is thrown.
cdm_get_tables()
returns a named list of dplyr tbl objects
of a dm
object.
Filtering expressions are NOT evaluated at this stage.
To get filtered tables, use tbl.dm()
cdm_get_filter()
returns the filter expressions that have been applied to a dm
object.
These filter expressions are not intended for evaluation, only for
information.
is_dm()
returns TRUE
if the input is of class dm
.
as_dm()
coerces objects to the dm
class