Into
The into function in DUQL is used to specify the destination for your query results. It allows you to name the output dataset, which can then be used in subsequent queries or operations.
Syntax
into: <output_name>Parameters
output_name
string
Yes
The name of the variable that will store the query results
Examples
Basic Usage
into: monthly_sales_reportAs Part of a Larger Query
dataset: sales_transactions
steps:
- filter: date >= @2023-01-01
- group:
by: [product_category]
steps:
- summarize:
total_sales: sum amount
- sort: -total_sales
into: top_selling_categoriesUse Cases
Creating Named Results: Use
intoto give meaningful names to query outputs for easier reference in subsequent analyses.Building Data Pipelines: Chain multiple queries together by using the output of one query as the input for another.
Temporary Table Creation: In database systems that support it,
intocan be used to create temporary tables for complex multi-step analyses.Materializing Views: Some database systems allow you to create materialized views, which can be achieved using the
intoclause.
Best Practices
🏷️ Use descriptive and meaningful names for your output to clearly indicate the content or purpose of the dataset.
🔄 When creating multiple outputs in a complex analysis, use a consistent naming convention to improve readability and maintainability.
📊 Consider the lifecycle of your data. If the output is temporary, you might want to use a prefix like
tmp_ortemp_in the name.🧹 In multi-step analyses, use
intoto create intermediate results, which can help in debugging and optimizing your queries.📚 Document the purpose and content of named outputs, especially in complex data pipelines or when sharing queries with team members.
Related Functions
dataset: Defines the main data source for the querysteps: Specifies the transformation steps before the final output
Limitations and Considerations
The behavior of
intomay vary slightly depending on the target database system specified in thesettingssection.Some database systems may have restrictions on table or view names, so be aware of any naming conventions or limitations in your target system.
When using
intoto create persistent tables or views, ensure you have the necessary permissions in your database system.
💡 Tip: The
intofunction is a powerful tool for structuring your data pipeline and creating reusable datasets. Use it strategically to break down complex analyses into manageable, logical steps!
Last updated
Was this helpful?