view_configs
Support for different "views" over existing datasets.
These allow constraining the usable data that is exposed to a modeller, or only presenting a transformed view to the modeller rather than the raw underlying data.
Classes
DropColViewConfig
class DropColViewConfig( source_dataset: str, drop_cols: Union[str, Sequence[str]], *args: Any,):
Config class for DropColsDropColView.
Arguments
drop_cols
: The columns to drop.source_dataset
: The name of the underlying datasource.
Ancestors
Methods
build
def build( self, underlying_datasource: Union[BaseSource, FileSystemIterableSource], connector: Optional[PodDbConnector] = None,) ‑> Union[DropColsDataview, DropColsFileSystemIterableDataview]:
Build a DropColsCSVDropColView from this configuration.
Arguments
underlying_datasource
: The underlying datasource for the view.connector
: An optional PodDbConnector object.
Returns A DropColsDataview object.
generate_schema
def generate_schema( self, underlying_datasource: BaseSource, name: str, force_stypes: Optional[MutableMapping[Union[Literal['categorical', 'continuous', 'image', 'text', 'image_prefix'], Literal['categorical', 'continuous', 'image', 'text']], List[str]]] = None, schema: Optional[BitfountSchema] = None,) ‑> BitfountSchema:
Schema generation for DropColViewConfig.
Arguments
underlying_datasource
: The underlying datasource for the view.name
: The name of the DropColViewConfig.force_stypes
: A mapping of table names to a mapping of semantic types to a list of column names.schema
: A BitfountSchema object. If provided, the schema will not be re-generated.
Returns A BitfountSchema object.
SQLViewConfig
class SQLViewConfig(source_dataset: str, query: str, *args: Any):
Config class for SQLDataViewConfig.
Arguments
query
: The SQL query for the view.source_dataset
: The name of the underlying datasource.
Raises
ValueError
: if the query does not start with SELECT.
Ancestors
Methods
build
def build( self, underlying_datasource: Union[BaseSource, FileSystemIterableSource], connector: Optional[PodDbConnector] = None,) ‑> Union[SQLDataView, SQLFileSystemIterableDataView, DataView]:
Build a SQLDataViewConfig from this configuration.
Arguments
underlying_datasource
: The underlying datasource for the view.connector
: An optional PodDbConnector object.
Returns A SQLDataView when connector is provided or An empty DataView when connector is not provided.
generate_schema
def generate_schema( self, underlying_datasource: BaseSource, name: str, force_stypes: Optional[MutableMapping[Union[Literal['categorical', 'continuous', 'image', 'text', 'image_prefix'], Literal['categorical', 'continuous', 'image', 'text']], List[str]]] = None, schema: Optional[BitfountSchema] = None, connector: Optional[PodDbConnector] = None,) ‑> BitfountSchema:
Schema generation for SQLDataViewConfig.
Arguments
underlying_datasource
: The underlying datasource for the view.name
: The name of the SQLDataViewConfig.force_stypes
: A mapping of table names to a mapping of semantic types to a list of column names.schema
: A BitfountSchema object. If provided, the schema will not be re-generated.connector
: An optional PodDbConnector object.
Returns A BitfountSchema object.
initialize
def initialize(self, pod_name: str) ‑> None:
Initialize the view by providing the pod name for the database.
ViewDatasourceConfig
class ViewDatasourceConfig(source_dataset: str, *args: Any, **kwargs: Any):
A class dictating the configuration of a view.
Arguments
source_dataset
: The name of the underlying datasource.
Ancestors
Subclasses
Methods
build
def build( self, underlying_datasource: ~_DS, connector: Optional[PodDbConnector] = None,) ‑> DataView:
Build a view instance corresponding to this config.
generate_schema
def generate_schema( self, *args: Any, **kwargs: Any,) ‑> BitfountSchema:
Schema generation for views.