It is important in business to be able to manage and analyze data well. Sigma Computing, a cloud-based analytics platform, helps data analysts and business professionals maximize their data with collaborative and scalable analytics.
One of Sigma’s key features is its support for custom SQL queries and CSV file uploads. These tools allow users to handle more advanced data tasks and analyses.
In this blog, we’ll explain why custom SQL and CSVs are important, demonstrate how to use these features in Sigma Computing, and provide some best practices to help you get started.
What is Sigma Computing, and Why Does it Matter?
Sigma Computing is a cloud-based business intelligence and analytics tool for collaborative data exploration, analysis, and visualization. Unlike traditional BI tools, its user-friendly interface ensures that users of all technical levels can seamlessly interact with data. The platform’s integration with cloud data warehouses like Snowflake AI Data Cloud, Google BigQuery, and Amazon Redshift makes it a vital tool for organizations harnessing big data.
Mastering custom SQL and CSVs in Sigma is essential for several reasons. It enhances data manipulation, provides flexibility in crafting custom datasets, and improves efficiency by optimizing performance and simplifying the process of incorporating external data.
Type | Enhanced Data Manipulation | Flexibility | Efficiency |
---|---|---|---|
CSV | Quickly incorporate ad-hoc datasets without needing complex ETL processes | Integrate external data sources that might not be readily available in their data warehouse | Simplify the process of incorporating external data |
SQL |
|
|
|
How to Use Custom SQL and CSVs in Sigma Computing
There are three primary methods for using SQL and CSVs. Each method offers unique benefits and flexibility tailored to different analytical needs within Sigma.
Scope:
Creating a new workbookÂ
Adding to existing workbooks
Establishing reusable datasets
Use Case:
Use the first method when you want to base your entire analysis on the results of a single SQL query or CSV file.
The second method enhances an existing workbook with additional data or specific insights derived from a SQL query or CSV file.
Utilize reusable datasets to maintain data consistency and streamline analyses across projects in Sigma.
Understanding and utilizing these approaches allows you to effectively leverage custom SQL and CSVs in Sigma Computing to meet your specific data analysis needs.
Using SQL in Sigma
Create a Workbook from SQL
Navigate to Sigma Home:
Log in to your Sigma Computing account.
Click on the Create New button in the upper left-hand corner.
Create a New Custom SQL Query:
Under the Explore Data section, select Write SQLÂ to open a new workbook window for building your SQL query.
In the side panel, choose a connection from the dropdown to select the database you want to query.Â
Note: Admin privileges in your Sigma organization are required to add new data connections.
Write Your SQL Query:
Begin writing your custom SQL query that addresses your specific data requirements. Sigma supports standard SQL syntax and offers autocomplete suggestions to assist you.
We will use Sigma’s Sample Data stored in Snowflake for this example.
SELECT
*
FROM
FUN.FAA.AIRPORTS
;
Execute the Query:
Select Run or use the shortcut (Alt + Enter) to execute the query and retrieve data results.
Curate Your Query:
Refine and expand your SQL query as needed to refine the dataset for your workbook. For example, you might filter the dataset to display only airport names containing the word “international.”
SELECT
*
FROM
FUN.FAA.AIRPORTS
WHERE AIRPORT LIKE '%International%'
;
Add Visualizations and Analysis:
In the newly created workbook, incorporate charts, graphs, tables, and other visual elements to analyze and present the data obtained from your SQL query.
Create a Workbook from SQL
Open an Existing Workbook:
Log in to Sigma Computing.
Open the workbook where you want to add a new element.
Add a New Element:
Click Add Element in the upper left corner of the workbook.
Select the type of element you want to add, typically a table or a visualization (VIZ), as these are the main options supporting SQL queries.
Select SQL Query as Your Source:
Choose the option to add an element using a SQL query. This will open an SQL editor where you can write your custom SQL query.
Write Your SQL Query:
Begin writing your custom SQL query to address your specific data requirements.
SELECT
*
FROM
FUN.FAA.AIRPORTS
;
Execute the Query:
Select Run or use the shortcut (Alt + Enter) to execute the query and retrieve data results.
Build Your Element:
You can switch between the view of the SQL editor and the VIZ element by selecting the SQLÂ icon at the top right corner of the element.
Curate Your Query if Needed:
Toggle back to the SQL editor to refine your query if necessary. In this example, we create a VIZ element and use the query results to build a bar chart.
Configure and Customize:
Customize the new element by adjusting visual properties, adding filters, or performing calculations to enhance the analysis.
Note: The custom SQL query is specific to the element it was created for. Any additional elements will require their own data connections.
Create a Workbook Element from SQL
Navigate to Sigma Home:
Log in to your Sigma Computing account.
Click on the Create New button located in the upper left-hand corner.
Create a New Dataset:
Under the Create New section, select Dataset.
On the New Dataset landing page, choose SQL.
Write Your SQL Query:
Begin crafting your custom SQL query to meet your specific dataset requirements.
Execute the Query:
Select Run or use the shortcut (Alt + Enter) to execute the query and retrieve data results.
Proceed with Your Dataset:
Click Get Started in the upper right-hand corner.
This will take you to the New Dataset from the SQL page. Here, you can review the metadata of the SQL query and its results, including column names, visibility, data types, and field descriptions.Â
Note: Additional Dataset menus are available but won’t be covered in this blog.
Using CSV Files in Sigma
Create a Workbook from a CSV File
Navigate to Sigma Home:
Log in to your Sigma Computing account.
Click on the Create New button located in the upper left-hand corner.
Select Upload CSVÂ to create a new workbook:
Under the Explore Data section, select Upload CSVÂ to open a new workbook window.
Upload the CSV File:
Browse your local files or drag and drop the CSV file into the designated area.
Configure the CSV Settings:
Adjust the settings to match your CSV file’s format, including column delimiters, text qualifiers, and whether the first row contains headers.
Build the Workbook:
Select Explore in the upper right-hand corner; this should load your data into your workbook space. You can now add visualizations, tables, and other elements to analyze and present your data.
Add a CSV File to an Existing Workbook
Open an Existing Workbook:
Log in to Sigma Computing.
Open the workbook where you want to add a new element.
Add a New Element:
Click Add Element in the upper left corner of the workbook.
Select the type of element you want to add.
Upload the CSV File:
Click on the option to add a new data source and select Upload CSV. Then, browse your computer to locate and select the CSV file.
Configure the CSV Settings:
Adjust any necessary settings, such as column delimiters and text qualifiers, to ensure the data is imported correctly.
Integrate the Data:
Once the CSV file is uploaded, you can use it with your existing data.Â
Create a Dataset from a CSV
Navigate to Sigma Home:
Log in to your Sigma Computing account.
Click on the Create New button located in the upper left-hand corner.
Create a New Dataset:
Under the Create New section, select Dataset.
On the New Dataset landing page, choose CSV.
Upload the CSV File:
Browse your local files or drag and drop the CSV file into the designated area.
Configure the CSV Settings:
Adjust the settings to match your CSV file’s format, including column delimiters, text qualifiers, and whether the first row contains headers.
Name and Save the Dataset:
Assign a descriptive name to your dataset and save it. The dataset is ready for use across different workbooks and analyses within Sigma.
Utilize the Dataset:
You can now select this dataset as a data source in any workbook, allowing consistent and centralized data management.
Best Practices for Using Custom SQL and CSVs in Sigma
Commenting Your Code: Well-commented SQL queries are essential for clarity, collaboration, and maintainability. Comments should explain complex logic, data transformations, dependencies, and important considerations, aiding in troubleshooting and modification.
Formatting SQL: Sigma provides a “Format SQL” button to standardize the styling of SQL queries, ensuring consistency and improving readability for all users. This feature helps streamline collaboration and facilitates a more straightforward understanding of SQL code across teams using Sigma Computing.
Scheduling Data Refresh: Establish regular data refresh schedules to ensure analyses are based on up-to-date information. Use Sigma’s scheduling capabilities to automate data refreshes at specified intervals or times when data updates occur, minimizing manual intervention and maintaining data accuracy.
Caching & Materialization: Use Sigma’s caching and materialization features to optimize query performance and reduce the load on data sources. Caching stores query results temporarily, while materialization precomputes and stores complex query results as tables, improving response times for frequently used datasets. It is important to note that materialized tables will rerun if the underlying conditions change, so be sure to place any user-facing control targets after the materialized table in your data model.
Securing Data Access: Establishing and enforcing data permission types in Sigma Computing ensures authorized personnel access only sensitive data based on their roles and responsibilities. This best practice enhances data security, maintains confidentiality, and facilitates compliance with regulatory requirements, mitigating unauthorized access and data breach risks.
Closing
Mastering custom SQL and CSVs in Sigma Computing can significantly enhance your data analysis capabilities, making your workflows more efficient and your insights more powerful. Following the steps outlined above, you can integrate complex data manipulations into your routine and leverage external data sources to enrich your analyses.Â
Now that you have these skills, you can explore more advanced projects and truly use the power of your data with Sigma Computing.Â
For expert guidance and additional support, contact phData. Our team can help you maximize Sigma Computing’s potential and get the most out of your data analytics.
FAQs
How do you add a data source in Sigma?
To add a data source in Sigma, navigate to the Data Manager and select Add Data Source. Choose your desired data source type (e.g., Snowflake, BigQuery) and follow the prompts to authenticate and connect to your data warehouse. You will need appropriate permissions to access the data source in Sigma, typically granted by your organization’s Sigma administrator or data governance team.
Do I need to use custom SQL to apply Attributes to users and teams?
No, you do not necessarily need to use Custom SQL to apply Attributes to users and teams in Sigma Computing. User Attributes can be configured and utilized directly within the Sigma interface to control and personalize data access. However, Custom SQL can be used to implement more complex or dynamic filtering based on user attributes, such as switching schemas or tables based on user roles or other characteristics. This approach enhances security and flexibility but is not required for basic attribute application.