Skip to content

Global config

The GlobalAppConfig holds configuration fields related to the global application.

Here are the (optional) configurable properties:

  • root_folder: The path of the base folder for the taipy application, its default value is "./taipy/".
  • storage_folder: The folder name used to store Taipy data, its default value is ".data/". It is used in conjunction with the root_folder field. That means the default storage path is "./taipy/.data/".
  • clean_entities_enabled: The field to activate/deactivate the clean entities feature. Its default value is ENV[TAIPY_CLEAN_ENTITIES_ENABLED]:bool meaning that the default value is read from the TAIPY_CLEAN_ENTITIES_ENABLED environment variable. If the environment variable is not set, the default value is False.
    Since it is risky to delete all entities on a production environment, Taipy proposes a way to activate this feature only on specific environments. That is why the default value points to an environment variable.
  • read_entity_retry: The integer number of retry when reading an entity after a failed attempt (in case of concurrent access). The default value is 0.
  • repository_type: The type of storage that will be used to hold Taipy entities. Available options are: filesystem, sql and mongo. If no repository type is informed, the filesystem will be used as the default repository.
  • repository_properties: A dictionary of properties that will be used to instantiate the chosen repository. Only required if the chosen repository is sql or mongo.
    If repository_type is set to filesystem, Taipy uses root_folder and storage_folder to store entities. In this case, repository_properties attribute is not required.
    If repository_type is set to sql, the db_location attribute is required as the path of a sqlite3 database file. Please refer to SQL storage section.
    If repository_type is set to mongo, the possible properties are mongodb_hostname, mongodb_user, mongodb_password, mongodb_port, application_db, properties. Please refer to MongoDB storage section.
1
2
3
4
5
6
7
8
from taipy import Config

Config.configure_global_app(root_folder=".taipy_root_folder/",
                            storage_folder=".data_folder",
                            clean_entities_enabled=True,
                            read_entity_retry=2,
                            version_name="1.0.0",
                            application_name="my_application",)
1
2
3
from taipy import Config

Config.load("config.toml")
config.toml
1
2
3
4
5
6
7
8
[TAIPY]

root_folder = ".taipy_root_folder/"
storage_folder = ".data_folder"
clean_entities_enabled = "True:bool"
read_entity_retry = "2:int"
version_name = "1.0.0"
application_name = "my_application"

In this example, we set custom values for the root_folder, storage_folder, clean_entities_enabled, and read_entity_retry parameters. Note that most of the time the default values can be used. In lines 7-8, two custom properties are specified: a version_name and an application_name.

SQL storage for Taipy entities

The configuration needed to use a SQL database, through sqlite3 engine, is described in the lines 7-8.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from taipy import Config

Config.configure_global_app(
    root_folder=".taipy_root_folder/",
    storage_folder=".data_folder",
    clean_entities_enabled=True,
    read_entity_retry=2,
    repository_type="sql",
    repository_properties={"db_location": "path_to_sqlite_file/database.db"}
    )
Taipy creates a table called taipy_model in the database described in the configuration, where it stores information about the taipy entities.

Here are the configurable properties for the SQL repository: - db_location: The path of a sqlite3 database file.

MongoDB storage for Taipy entities

Available in Taipy Enterprise edition

This section is relevant only to the Enterprise edition of Taipy.

The configuration needed to use a mongo database is described in the lines 7-14.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from taipy import Config

Config.configure_global_app(root_folder=".taipy_root_folder/",
                            storage_folder=".data_folder",
                            clean_entities_enabled=True,
                            read_entity_retry=2,
                            repository_type="mongo",
                            repository_properties={
                              "mongodb_hostname": "localhost",
                              "mongodb_user": "username",
                              "mongodb_password": "passwd",
                              "mongodb_port": 27017,
                              "application_db": "taipy"
                            }
                            )

Taipy will create a collection, in the database described in the configuration, for each taipy entity(Cycle, Scenario, Pipeline, Datanode, Task and Job), where it will store information about the taipy entities.

Here are the configurable properties for the Mongo repository:

  • mongodb_hostname: The URL for the mongo database.
  • mongodb_user: The username to access the database.
  • mongodb_password: The password to access the database.
  • mongodb_port: The port to access the database. This property is optional and has 27017 as a default value.
  • application_db: The database that will hold the taipy collections.

The next section introduces the job orchestration configuration.