SQL Export¶
This section covers how to export FeatureByte features as SQL code. SQL export requires a deployment that contains the features you want to export.
Prerequisites¶
Before exporting SQL, you need:
- Features created through Feature Ideation or defined manually
- A deployment containing your features
Export from UI¶
Step 1: Navigate to Your Deployment¶
Go to the Deployments catalog and select the deployment containing the features you want to export.

Step 2: Generate SQL¶
- Click the SQL tab in the deployment view
- Click Generate SQL (if the SQL hasn't been generated yet)
- FeatureByte will generate SQL containing all features in the deployment

Step 3: Copy the SQL¶
Once generated, you can:
- Copy the SQL directly from the UI
- Use the Regenerate SQL button to refresh the SQL if needed
Using the SQL Template¶
The exported SQL is a SELECT statement with placeholders like {{ CURRENT_TIMESTAMP }}. As shown in the screenshot above, the SQL includes all features from your deployment and uses these placeholders for dynamic timestamp values.
To use this SQL in your environment, you need to fill in the placeholders and then wrap it for your specific use case:
Filling Placeholders¶
Replace {{ CURRENT_TIMESTAMP }} with your desired timestamp. For date strings, ensure proper casting to TIMESTAMP:
# For historical computation
sql_for_date = sql_template.replace("{{ CURRENT_TIMESTAMP }}", "CAST('2024-01-15' AS TIMESTAMP)")
# For current computation
sql_current = sql_template.replace("{{ CURRENT_TIMESTAMP }}", "CURRENT_TIMESTAMP()")
Wrapping the SQL¶
Create a new table when you want to store the computed features:
CREATE TABLE customer_features
USING DELTA
PARTITIONED BY (POINT_IN_TIME)
AS
SELECT ... -- your exported SQL here
Insert into an existing table for regular batch updates:
Create a view for on-demand feature computation:
Next Steps¶
See Scheduling Examples for how to operationalize this SQL.