Add a Computed File¶
Add a Computed File to a DFS source datastore by writing one Spark SQL query over one of its files. The Computed File becomes a container inside that datastore, next to the file patterns, and can be profiled and monitored like any other container.
Related
- Concept: Introduction for what a Computed File is.
- Mechanics: How It Works for the query rules, validation, and the form's fields.
- Comparison: Computed File vs Computed Table if you are not sure which one you need.
Profile the file first
The file your query reads must have been profiled at least once. If it has not, Validate and Save refuse the query. Run a profile on the file, then come back to the form.
Step 1: Open the DFS datastore (Amazon S3, Google Cloud Storage, or Azure Data Lake Storage) and click Add at the top right.
Step 2: Select Computed File . The Add Computed File dialog opens.
Step 3: Enter a Name. Spaces are replaced with underscores when you leave the field.
Step 4: Write the Query: one Spark SQL query that reads one file of the datastore, named in backticks as it appears in the datastore.
Press Ctrl+Space in the editor for the datastore's files and their fields. Click Expand editor for a larger editor.
Step 5: Click Preview , or press Ctrl+Enter (Cmd+Enter on a Mac). Qualytics validates the query first, then shows a Sample of the first 25 rows under the editor.
- If the query is refused, the error appears instead of the rows. Fix the query and preview again.
- Open in Explore opens the query in Explore, in a new browser tab, to read more rows.
- When you change the query, the sample says
The query changed. Preview again to update the sample.
Step 6: Optionally, fill in the rest of the form:
- Description: opens a Markdown editor. When AgentQ is set up for your deployment, Suggest drafts a description from the query.
- Owner: you by default. Only users with the Editor team permission can pick another owner.
- Additional Metadata: key-value pairs. A key also gives the default value of a
{{ variable }}with the same name in the query. When the query uses a variable that has no value yet, the form asks you to add it here.
Step 7: Click Validate to check the query without previewing it. Validation Successful appears when the query passes. This step is optional: Save runs the same checks.
Step 8: Click Save. A success message confirms that the computed file has been created, the dialog closes, and the new Computed File appears in the datastore's containers. Qualytics profiles it right away on a sample of up to 1,000 records per partition, then runs a full profile in the background.
Start from Explore
On a file datastore, Explore can save the query you are working on as a Computed File. The same dialog opens with your query already filled in.