๐ค Export Data to CSV, JSON or XML & Save Scripts in Folders | Azure Synapse Analytics Tutorial
Azure Synapse Analytics provides an easy way to export query results to file formats such as CSV
, JSON
, or XML
using the built-in Export functionality in the Synapse Studio UI. This is especially helpful when using Serverless SQL Pools to analyze external files and then saving the results for reporting or sharing.
๐ง What Is Export in Synapse Studio?
After running a query in the Synapse SQL script editor using Serverless SQL Pools, you can directly export the results by clicking the Export button and choosing the desired format.
Supported Formats:
- CSV – Standard format for tabular data
- JSON – Structured data, often used in web and API systems
- XML – Hierarchical markup format used for data exchange
๐งช Example
SELECT Country, COUNT(*) AS TotalCustomers
FROM OPENROWSET(
BULK 'https://yourstorage.dfs.core.windows.net/container/customers/*.csv',
FORMAT = 'CSV',
PARSER_VERSION = '2.0',
HEADER_ROW = TRUE
) AS customers
GROUP BY Country;
Once this query runs, click the Export button above the results pane and choose CSV, JSON, or XML to download the output.
๐ Saving Scripts to Folders
Azure Synapse Studio also allows you to save your SQL scripts and notebooks in custom folders. This helps organize your workspace and makes it easier to collaborate or revisit queries later.
Steps to Save a Script:
- After writing or running a script, click the Save As icon
- Select the destination folder or create a new one
- Provide a name and confirm to save the script
๐ Benefits
- Download query results with a single click
- No manual data copying or transformation required
- Scripts are versionable and organized in workspaces
๐บ Watch the Full Tutorial
Credit: This article was created with the assistance of ChatGPT and Gemini.
No comments:
Post a Comment