Create Subset
A subset is defined by a query that specifies which part of a dataset (=view) is included. By default, the DBRepo restricts certain operations (e.g. computing functions) to ensure i) long-term stability, ii) -compatibility and iii) cross-database vendor compatibility for future possible migration scenarios.
Currently, only plain SELECT column1, ... FROM some_view [ORDER BY ... [ASC|DESC]] statements are supported for subset
creation.
UI¶
A subset can be created by specifying a source view (e.g. My View), select the columns that are included in the subset
and optionally filter by values (e.g. lot_shape = Reg).
Python¶
from dbrepo.RestClient import RestClient
from dbrepo.api.dto import QueryDefinition, FilterDefinition, FilterType
client = RestClient("http://<hostname>", username="foo", password="bar")
subset = client.create_subset(<database_id>,
                              QueryDefinition("my_view",
                                              ["order", ...],
                                              filter=FilterDefinition(FilterType.WHERE, "lot_shape", "=", "Reg"),
                                              page=0,
                                              size=1000000))
printf(f"subset id: {subset.id}")