Deploy Features in a Repository to a Workspace
Your Tecton Repository contains Tecton Object Definitions which define feature pipelines and other dataflows.
When you make changes to your Repository locally and apply them to a selected
Target Workspace (using the tecton apply
CLI command), Tecton does the
following:
- Tecton identifies the diff between the Target Workspace's current state vs. the newly-applied state and validates any new or updated Object Definitions
- Tecton updates the Workspace Configuration accordingly (e.g. by setting up required pipelines, spinning up online or offline table(s), modifying Feature View definitions, connecting to new Data Sources, etc.).
- The changes are applied to the
current workspace
that is selected in your Tecton CLI. (To see the selected Workspace, run
tecton workspace show
. To change the selected Workspace, runtecton workspace select your_workspace
). - Changes that have been applied become available on your Tecton instance; for example, feature pipelines run against applied features and write the results to the online and offline stores.
Making a change to a Tecton Repository​
As an example, add the file my_entity.py
, which contains an Entity
object,
to a local Tecton Repository:
# my_repo/my_entity.py
from tecton import Entity
user = Entity(name="user", join_keys=["user_id"], description="My first entity!")
It's important to declare Tecton Objects as global variables in your Python
module. When plan
or apply
commands are run, the Tecton CLI references all
Python objects instantiated in the global
scope to identify objects in the
Tecton Repository.
Previewing changes using tecton plan
​
To preview changes made to your local Tecton Repository, run tecton plan
.
These are the changes that will be applied if tecton apply
is run (the next
step).
$ tecton plan
Using workspace "my_workspace" on cluster https://my_app.tecton.ai
✅ Imported 1 Python module from the feature repository
✅ Collecting local feature declarations
✅ Performing server-side validation of feature declarations
↓↓↓↓↓↓↓↓↓↓↓↓ Plan Start ↓↓↓↓↓↓↓↓↓↓
+ Create Entity
name: user
description: My first entity!
↑↑↑↑↑↑↑↑↑↑↑↑ Plan End ↑↑↑↑↑↑↑↑↑↑↑↑
Pushing changes using tecton apply
​
Running tecton apply
will generate the same output as tecton plan
, along
with a final prompt to apply the changes.
$ tecton apply
Using workspace "my_workspace" on cluster https://my_app.tecton.ai
✅ Imported 1 Python module from the feature repository
✅ Collecting local feature declarations
✅ Performing server-side validation of feature declarations
↓↓↓↓↓↓↓↓↓↓↓↓ Plan Start ↓↓↓↓↓↓↓↓↓↓
+ Create Entity
name: user
description: My first entity!
↑↑↑↑↑↑↑↑↑↑↑↑ Plan End ↑↑↑↑↑↑↑↑↑↑↑↑
Are you sure you want to apply this plan? [y/N]> y
🎉 all done!
If you see the message "all done!", as shown above, then your changes have been pushed to to the Tecton Repository.
If your Repository contains multiple changes, tecton apply
will apply all
changes at once.
Running tecton plan
before tecton apply
is not required.
Types of Repository changes​
There are 5 types of changes that can be applied to a Repository:
+ Create
: A new object is being created for the first time.- Delete
: A previously created object is being deleted.~ Recreate
: A change to an existing Tecton Object that requires it to be recreated in the remote Tecton Repository. This often occurs when transformations are updated or dependencies change between Objects. For example, changing a Data Source definition may require any Feature Views that depend on it to be recreated and re-materialized. This is also known as a destructive update.~ Update
: An update to an existing Tecton Object's properties which doesn't require it to be recreated (e.g. changing thedescription
of a FeatureView). This is also known as a non-destructive update.~ Upgrade
: No-op updates of Objects to meet the latest Tecton API version. These are sometimes observed after upgrading the Tecton SDK usingpip3
and should be considered safe.
Examples​
Below are examples of create, delete, and update changes:
$ tecton apply
Using workspace "prod"
✅ Imported 3 Python modules from the feature repository
✅ Collecting local feature declarations
✅ Performing server-side validation of feature declarations
↓↓↓↓↓↓↓↓↓↓↓↓ Plan Start ↓↓↓↓↓↓↓↓↓↓
- Delete Entity
name: my_entity
owner: alice
+ Create Entity
name: my_new_entity
owner: alice
~ Update FeatureView
name: my_feature_view
owner: alice
description: -> Description of this FeatureView!
↑↑↑↑↑↑↑↑↑↑↑↑ Plan End ↑↑↑↑↑↑↑↑↑↑↑↑
Are you sure you want to apply this plan? [y/N]> y