# otp.ShowDerivedDbList

### *class* ShowDerivedDbList(, db_discovery_scope='query_host_only', time_range='configured_time_interval', selection_criteria='all', symbol=utils.adaptive, db=utils.adaptive, tick_type='ANY', start=utils.adaptive, end=utils.adaptive, query_parameters=None, \*\*kwargs)

Bases: [`Source`](https://docs.pip.distribution.sol.onetick.com/api/source/root.html.md#onetick.py.Source)

Shows the list of derived databases.

Output: A list of derived databases, represented in base_db_name//derived_db_name format.
Database names in the output are unique.
Will skip processing of directories which have <.tmp> extension.

* **Parameters:**
  * **db_discovery_scope** ([*str*](https://docs.pip.distribution.sol.onetick.com/api/operation/str/root.html.md#onetick.py.Operation.str)) -- 

    `query_host_and_all_reachable_hosts`, `query_host_only` (default).

    When `query_host_and_all_reachable_hosts` is specified,
    an attempt will be performed to get derived databases from all hosts reachable from the process
    (it could be a client process, or could be a tick server, depending on where a queried symbol resides)
    where the query containing this event processor is executed.

    When `query_host_only` is specified,
    only derived databases from the host on which the query is performed will be returned.
  * **time_range** ([*str*](https://docs.pip.distribution.sol.onetick.com/api/operation/str/root.html.md#onetick.py.Operation.str)) -- 

    `configured_time_interval` (default), `query_time_interval`.

    When `configured_time_interval` is specified,
    an attempt will be performed to get all possible derived databases.

    When `query_time_interval` is specified,
    only derived databases that have data/raw data within the specified query time interval will be returned.
  * **selection_criteria** ([*str*](https://docs.pip.distribution.sol.onetick.com/api/operation/str/root.html.md#onetick.py.Operation.str)) -- Possible values are `all`, `derived_from_current_db` and `direct_children_of_current_db`.
    Default value is `all`.
  * **symbol** (str, list of str, [`Source`](https://docs.pip.distribution.sol.onetick.com/api/source/root.html.md#onetick.py.Source), [`query`](https://docs.pip.distribution.sol.onetick.com/api/misc/query.html.md#onetick.py.query), [`eval query`](https://docs.pip.distribution.sol.onetick.com/api/misc/eval.html.md#onetick.py.eval)) -- 

    Symbol name to bind to the OneTick's graph node.

    The database of the symbol is the current (parent) database for `selection_criteria`
    and it also defines the process where the query is executed.
    The symbols should be of the form `<db_name>::` or `<db_name>::<some symbol name>`,
    so if parameter `db` is set, the symbol is bound as `<db>::<symbol>`,
    otherwise the symbol must contain the database name.

    If the value is not a string (e.g. [`Source`](https://docs.pip.distribution.sol.onetick.com/api/source/root.html.md#onetick.py.Source)), it is used as is
    (so the symbols must contain the database name) and parameter `db` can't be set.

    If neither `symbol` nor `db` is set,
    the symbols from [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run) are used.
  * **db** ([*str*](https://docs.pip.distribution.sol.onetick.com/api/operation/str/root.html.md#onetick.py.Operation.str) *,* *optional*) -- 

    Name of the database.
    It is bound to the OneTick's graph node as a part of the symbol (`<db>::` or `<db>::<symbol>`),
    so symbols can't be passed to [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run) if this parameter is set.

    If not set, the database should be specified in `symbol`
    or in the symbols of [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run).

    This database is the current (parent) database for `selection_criteria`,
    so if `selection_criteria` is not `all`, it must be set in this parameter or in the symbols.
    A warning is shown if neither this parameter nor `symbol` is set in this case.
  * **tick_type** ([*str*](https://docs.pip.distribution.sol.onetick.com/api/operation/str/root.html.md#onetick.py.Operation.str)) -- 

    Tick type to set on the OneTick's graph node.

    Default: `ANY`
  * **start** ([`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime), [`otp.datetime`](https://docs.pip.distribution.sol.onetick.com/api/datetime/dt.html.md#onetick.py.datetime)) -- Time interval from which the data should be taken.
    Not set by default -- the values from [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run) will be used.
  * **end** ([`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime), [`otp.datetime`](https://docs.pip.distribution.sol.onetick.com/api/datetime/dt.html.md#onetick.py.datetime)) -- Time interval from which the data should be taken.
    Not set by default -- the values from [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run) will be used.
  * **query_parameters** ([`otp.QueryParameters`](https://docs.pip.distribution.sol.onetick.com/api/misc/query_parameters.html.md#onetick.py.QueryParameters)) -- Additional query properties to be set in the resulting .otq file.
    They will be used if they are not overridden by other parameters or in [`otp.run`](https://docs.pip.distribution.sol.onetick.com/api/run.html.md#onetick.py.run).

### Examples

Let's create a derived database and a database derived from it:

```pycon
>>> db = otp.DB('WRITE_DB//DERIVED')
>>> session.use(db)
>>> db.add(otp.Ticks(A=[1]))
>>> db_2x = otp.DB('WRITE_DB//DERIVED//DERIVED_2X')
>>> session.use(db_2x)
>>> db_2x.add(otp.Ticks(A=[1]))
```

Get the list of all databases derived from the database:

```pycon
>>> data = otp.ShowDerivedDbList(selection_criteria='derived_from_current_db', db='WRITE_DB')
>>> otp.run(data)
        Time                DERIVED_DB_NAME
0 2003-12-01              WRITE_DB//DERIVED
1 2003-12-01  WRITE_DB//DERIVED//DERIVED_2X
```

Get the list of direct children of the database:

```pycon
>>> data = otp.ShowDerivedDbList(selection_criteria='direct_children_of_current_db', db='WRITE_DB')
>>> otp.run(data)
        Time    DERIVED_DB_NAME
0 2003-12-01  WRITE_DB//DERIVED
```

#### SEE ALSO
**SHOW_DERIVED_DB_LIST** OneTick event processor
<br/>
[`onetick.py.derived_databases()`](https://docs.pip.distribution.sol.onetick.com/api/data_inspection/derived_databases.html.md#onetick.py.derived_databases)
<br/>
[`otp.ShowDbList`](https://docs.pip.distribution.sol.onetick.com/api/sources/show_db_list.html.md#onetick.py.ShowDbList)
<br/>
