Last active
May 5, 2022 19:39
-
-
Save mdrakiburrahman/481632ccda4f8a130bd6c2d0d10fe13b to your computer and use it in GitHub Desktop.
Creating a simple External on top of Parquet file that exposes a subset of the columns to end user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE Ldw | |
COLLATE Latin1_General_100_BIN2_UTF8; | |
USE Ldw; | |
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'MyRand0mPa33W0rd1!'; | |
CREATE DATABASE SCOPED CREDENTIAL WorkspaceIdentity | |
WITH IDENTITY = 'Managed Identity'; | |
GO | |
CREATE EXTERNAL DATA SOURCE ecdc_cases WITH ( | |
LOCATION = 'https://synapsesvrlesstest.dfs.core.windows.net/synapse/customers/', | |
CREDENTIAL = WorkspaceIdentity | |
); | |
CREATE EXTERNAL FILE FORMAT ParquetFormat WITH ( FORMAT_TYPE = PARQUET ); | |
GO | |
create schema ecdc_adls; | |
create external table ecdc_adls.customers ( | |
CustomerKey int, | |
CustomerID int | |
) with ( | |
data_source=ecdc_cases, | |
location = 'customers.parquet', | |
file_format = ParquetFormat | |
); | |
SELECT * FROM ecdc_adls.customers; | |
CREATE USER [synapsetest@rakirahman.me] FROM EXTERNAL PROVIDER; | |
GO | |
DENY ADMINISTER DATABASE BULK OPERATIONS TO [synapsetest@rakirahman.me] | |
GO | |
GRANT SELECT ON SCHEMA::ecdc_adls TO [synapsetest@rakirahman.me] | |
GO | |
GRANT SELECT ON OBJECT::ecdc_adls.customers TO [synapsetest@rakirahman.me] | |
GO | |
GRANT REFERENCES ON DATABASE SCOPED CREDENTIAL::WorkspaceIdentity TO [synapsetest@rakirahman.me] | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment