Skip to main content

Environment views

From the left sidebar you can navigate to several environment views: Outline, Files, Data sources, Environment, and Variables (including Secrets and Environment variables).

Files

Upload files for use in a given project. You can load in source data, figures, images, etc.

Compute Profiles

Depending on the needs of your project, you can opt into more (or less!) memory and processing power by changing the size of your kernel.

Compute Profiles can be changed in the Environment section on the left side panel by adjusting the Size dropdown under Compute Profile. Profiles range from 2-32 GB of memory and 0.25 - 4 CPUs.

SizeRAM (GB)CPU
X Small20.25
Small40.5
Medium (default)81
Large162
X Large324
tip

Users on Community plans are limited to small kernels, users on Professional plans can select up to medium kernels, and users on Teams or Enterprise plans can use any kernel size. For more info, see Hex's pricing page.

By default, projects are created with a Medium profile. Note that if you have configured scheduled runs of a project, those will run with the compute profile as set in the latest published version of your project.

Variables

Secrets

Keep your sensitive values, like API tokens or passwords, secret by adding them as Secrets. We store all Secrets in a highly-encrypted vault, which is only visible to other users with "Full Access" or "Can Edit" project permissions. Secrets can be referenced in Python cells, but an attempt to display them in the Logic View or App Builder will return [SECRET VALUE] .

Add Secrets to your project environment easily and securely.

You can add a Secret to a project by clicking the +Add button in the Secrets tab of the left sidebar. If you want to use a Secret which is defined as a shareable, workspace Secret, choose Import workspace secret from the menu to be presented with Secrets which are available for import. If you want to create a Secret for use only in the given project select Create project secret.

To access your Secrets, call them directly in place of where you would hard-code your credentials. In the example below, we're setting up a Snowflake connection and passing the database details as Secrets.

Environment variables

You can configure environment variables to be used in your projects. Environment variables aren't kept in the encrypted vault, nor are they redacted. Setting an environment variable in the left side panel is equivalent to using the python os library directly in your logic.

See more documentation for the os library here.

Built-in variables

We also have some variables which are automatically included in your project. These variables can be referenced in any logic cell.

VariableValueDescription
hex_scheduledFalse/TrueIf the run is being executed as part of a scheduled run, this variable is set to True. If the run is executed in any other context, the variable is set to False.
hex_run_context"logic", "app", "scheduled", "api-triggered"Describes the context that the project is being run in. Helpful if you want to restrict certain logic to only run in particular run contexts. For example, use this if you have some debug code that you want to run in the logic, but don't want to run while a user is interacting with the published app.
hex_user_emailemailIf a user is logged in and viewing a published app, this variable is equal to the email address associated with their user account. Helpful if you want to customize what a given user sees in the app. Check out this tutorial for an example.
hex_timezone"America/Los_Angeles", "Australia/Sydney", etc.The timezone selected for the project. By default this is the workspace timezone, but can also be overridden at the project level, as well as for specific app sessions. See Chart cell timezones for more information.
hex_color_palette['#4C78A8', '#F58518', '#E45756', ... ]An array of CSS color codes that map to the currently active workspace color palette. Using this variable can help create consistently themed visualizations when using both the native Chart cell and visualizations created via Python packages.

Mute cells

If there are cells in your project that you only want to execute in specific contexts (e.g. on project runs in Logic view, only during scheduled runs, etc.), you can do so using the built-in hex_run_context and hex_scheduled variables. With these variables, you can check the context for when each cell is run and execute the desired logic accordingly. See the below code snippets for some examples code!

if hex_run_context == 'logic':
## Something that only needs to happen during a Logic run
else:
## otherwise this cell will be muted

Similarly, you can do the same in an SQL cell via Jinja.

{% if hex_run_context == 'logic' %}
-- Something that only needs to happen during a Logic run

{% endif %}

Variable explorer

The Variable explorer allows you to browse the objects generated by your code. For each object, we show you its name, type, and value.