Search code examples
sql-servert-sqlparquetazure-synapse

Why this T-SQL query doesn't work in Synapse?


I am testing Synapse. I tried this query

SELECT
    TOP 100 *
FROM
    OPENROWSET(
        BULK '<path to the parquet file>',
        FORMAT='PARQUET'
    ) AS [result]

But I get the following error. How can I solve it?

Parse error at line: 4, column: 5: Incorrect syntax near 'OPENROWSET'.


Solution

  • That type of query would work in the serverless SQL pool, as per the documentation on OPENROWSET. It would not work in a dedicated SQL pool.

    If you are in Synapse Studio, try changing the Connect to option to Built-in, which is the serverless engine. Optionally create a database to store objects like external data sources, external tables and views in:

    Synapse Studio

    Another easy way to generate a working OPENROWSET statement would be via Synapse Studio > Data hub (the little cylinder on the right), Linked > double-click your datalake to navigate to the parquet file you want to query > right-click it > SELECT TOP 100 ...

    Synapse Studio 2