DomainsDictionary
A DomainsDictionary is used to map an entire database from an arbitrary schema to a PhenEx internal representation.
Attributes:
Name | Type | Description |
---|---|---|
domains_dict |
Dict[str, class]
|
A dictionary where keys are domain names and values are uninstantiated PhenexTable class objects. |
Methods:
Name | Description |
---|---|
get_mapped_tables |
Get all tables mapped to PhenEx representation using the given connection. |
get_source_tables |
Get all source tables using the given connection. |
set_mapped_tables |
Create a view for all mapped tables in the destination database. |
Source code in phenex/mappers.py
get_mapped_tables(con)
Get all tables mapped to PhenEx representation using the given connection.
If a database is not provided, the current database of the connection is used to find the tables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
con
|
The connection to the database. |
required |
Returns:
Type | Description |
---|---|
Dict[str, PhenexTable]
|
Dict[str, PhenexTable]: A dictionary where keys are domain names and values are mapped tables. |
Source code in phenex/mappers.py
get_source_tables(con)
Get all source tables using the given connection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
con
|
The connection to the database. |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
Dict[str, str]: A dictionary where keys are the source table names and values are table names. |
Source code in phenex/mappers.py
set_mapped_tables(con, overwrite=False)
Create a view for all mapped tables in the destination database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
con
|
The connection to the database. |
required | |
overwrite
|
Whether to overwrite existing views if found. Otherwise, throws an error. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Table]
|
Dict[str, Table]: A dictionary where keys are domain names and values are mapped tables. |