Knowledge Base
Querying Company Data
Querying Your Data with NQL
Learn to query datasets that are owned by your own Company using NQL, focusing on the significance of access rules and efficient data querying within the Narrative Data Collaboration Platform.
Example Query
This query accesses a specific dataset within your company's data , selecting fields based on certain criteria.
SELECT "field_name"
FROM company_data."dataset_name"
WHERE "field_name" = 'value'
Company Data Namespace
The company_data
namespace is an alias for your own Company in the Narrative platform. Within Narrative, each company object has a unique identifier. This unique identifier can be used to select data from that company (where access has been granted by an appropriate Access Rule).
If your company unique identifier was "company_1", the following two statements in an NQL query would be snynomyms:
FROM company_data."dataset_name"
and
FROM company_1."dataset_name"
Access Rules and Dataset Querying
Querying any data with NQL requires that the dataset has been associated with at least one access rule, which govern permissions to datasets. These rules ensure data access is compliant with company policies and data governance standards. This is true even of your own data; there must always be an access rule present in order to execute a query.
Best Practices for NQL Queries
This query also follows several best practices for NQL, including always double-quoting the table and field names. Read more best practices here:
NQL Best Practices
Best practices for querying data via NQL.