For NQL syntax and language features, see the NQL Reference.
Prerequisites
- SDK installed and configured (see SDK Quickstart)
- Familiarity with NQL syntax
- An API key with query permissions
Running a query
Basic execution
UseexecuteNql() to run a query and retrieve results:
Query input options
TheexecuteNql() method accepts the following options:
Creating a view dataset
Setcreate_as_view to true to create a view dataset instead of a materialized view. A view dataset stores only the NQL query definition—not the query results. The NQL is inlined and re-evaluated at query time whenever other queries reference the view dataset.
Understanding the result
TheNqlResult object contains execution metadata:
Validating a query
UsevalidateNql() to check query syntax without execution:
Compiling a query
UsecompileNql() to see the transpiled SQL without executing:
- Debugging query issues
- Understanding how NQL maps to the underlying SQL dialect
- Verifying Rosetta Stone mappings
Parsing a query
UseparseNql() to get the abstract syntax tree (AST):
Retrieving a previous query
If you have a job ID from a previous query, retrieve its results:Query patterns
Filtering data
Aggregations
Using Rosetta Stone attributes
Query normalized data across datasets:Error handling
Wrap query execution in try-catch to handle errors:Best practices
Related content
NQL Syntax Reference
Complete NQL language reference
NQL Design Philosophy
Understanding NQL’s approach
Query Optimization
Tips for efficient queries
Error Handling
Handle SDK errors gracefully

