Setup
-
cd
into the directory where you want to instantiate your Liminal environment. This will be the root directory where your schemas will be defined. Note: the Liminal CLI must always be run from within this root directory. -
Run
liminal init
in your CLI to initialize your Liminal environment. This will create aliminal/
directory that contains anenv.py
file and aversions/
directory.- The
env.py
file is used to store your Benchling connection information. - The
versions/
directory is used to store your revision files.
- The
-
Populate the
env.py
file with your Benchling connection information, following the instructions in the file. For example:from liminal.connection import BenchlingConnection, TenantConfigFlags PROD_CURRENT_REVISION_ID = "12b31776a755b" # It is highly recommended to use a secrets manager to store your credentials. connection = BenchlingConnection( tenant_name="pizzahouse-prod", tenant_alias="prod", current_revision_id_var_name="PROD_CURRENT_REVISION_ID", api_client_id="my-secret-api-client-id", api_client_secret="my-secret-api-client-secret", warehouse_connection_string="...", internal_api_admin_email="my-secret-internal-api-admin-email", internal_api_admin_password="my-secret-internal-api-admin-password", config_flags=TenantConfigFlags(...) )
- Required: The
api_client_id
andapi_client_secret
are used to connect to Benchling's SDK. For more information, see the Benchling API documentation. - Required: The
internal_api_admin_email
andinternal_api_admin_password
are used to connect to Benchling's API for the migration service. This must be the email and password used to log in to an Admin account. - Optional: The
warehouse_connection_string
is used to connect to Benchling's read-only warehouse. If you have access, set this as the connection string for the warehouse. - Optional: The
config_flags
parameter is used to set tenant-specific configuration flags. For more information, see the BenchlingConnection reference.- Set
schemas_enable_change_warehouse_name
toTrue
if you want to enable changing schema and field warehouse names.
- Set
The
CURRENT_REVISION_ID
variable is used to store the current state of where your Benchling tenant lies on the revision timeline. The id is therevision_id
of the revision file that has been applied to your Benchling tenant.Tip
If you have multiple Benchling tenants you'd like to synchronize, you can define multiple Benchling connections in the
env.py
file by creating multipleBenchlingConnection
objects and respectiveCURRENT_REVISION_ID
variables. - Required: The
-
If your Benchling tenant has pre-existing schemas, run
liminal generate-files <benchling_tenant_name> -p [<write_path>]
to populate the root directory with your schema files from the given Benchling tenant. Your file structure should now look like this:pizzahouse/ liminal/ env.py versions/ <revision_id>_initial_init_revision.py dropdowns/ ... entity_schemas/ ...
Tip
It is recommended to generate files using your production Benchling tenant. These schemas will be used as the single source of truth for your production tenant as well as other tenants you may have.
-
Add your schema imports to the env.py file. For example:
from pizzahouse.dropdowns import * from pizzahouse.entity_schemas import *
Warning
This is necessary for Liminal to recognize what schemas exist in your environment.
-
Set up is complete! You're now ready to start using your schemas defined in code as the single source of truth for your Benchling tenant(s).