> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# atoti.Hierarchy.virtual

#### *property* Hierarchy.virtual *: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None)*

Whether the hierarchy is virtual or not.

A virtual hierarchy does not store in memory the list of its members.
Hierarchies with large cardinality are good candidates for being virtual.

By default, a given hierarchy is automatically set as virtual if and only if it comes from an [`ExternalTable`](./atoti.directquery.external_table#atoti.ExternalTable) and one of the following conditions is met:

* The hierarchy has a cardinality of 10000 or more;
* The `activeviam.experimental.forceVirtualHierarchies` property is set to `true`.

<Note>
  As its name suggests, `activeviam.experimental.forceVirtualHierarchies` is an experimental/temporary property which may change in future bugfix releases.
</Note>

### Example

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> from atoti_directquery_clickhouse import ConnectionConfig, TableConfig
>>> connection_config = ConnectionConfig(
...     url=f"clickhouse:http://localhost:{clickhouse_server_port}/{schema_name}",
... )
>>> table_config = TableConfig(keys={"id"})
```

* Without `activeviam.experimental.forceVirtualHierarchies`:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> session = tt.Session.start()
  >>> external_database = session.connect_to_external_database(
  ...     connection_config
  ... )
  >>> sales_table = session.add_external_table(
  ...     external_database.tables["sales"], config=table_config
  ... )
  >>> cube = session.create_cube(sales_table)
  >>> cube.hierarchies["product"].virtual
  False
  ```
* With `activeviam.experimental.forceVirtualHierarchies`:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> session_config = tt.SessionConfig(
  ...     java_options=["-Dactiveviam.experimental.forceVirtualHierarchies=true"]
  ... )
  >>> session = tt.Session.start(session_config)
  >>> external_database = session.connect_to_external_database(
  ...     connection_config
  ... )
  >>> sales_table = session.add_external_table(
  ...     external_database.tables["sales"], config=table_config
  ... )
  >>> cube = session.create_cube(sales_table)
  >>> cube.hierarchies["product"].virtual
  True
  ```
