You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql/create-use-views.md
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,31 @@ The folder name in the `OPENROWSET` function (`yellow` in this example) that is
119
119
120
120
Delta Lake is in public preview and there are some known issues and limitations. Review the known issues on [Synapse serverless SQL pool self-help page](resources-self-help-sql-on-demand.md#delta-lake).
121
121
122
+
### JSON views
123
+
124
+
The views are the good choice if you need to do some additional processing on top of the result set that is fetched from the files. One example might be parsing JSON files where we need to apply the JSON functions to extract the values from the JSON documents:
125
+
126
+
```sql
127
+
CREATE OR ALTER VIEW CovidCases
128
+
AS
129
+
select
130
+
*
131
+
from openrowset(
132
+
bulk 'latest/ecdc_cases.jsonl',
133
+
data_source ='covid',
134
+
format ='csv',
135
+
fieldterminator ='0x0b',
136
+
fieldquote ='0x0b'
137
+
) with (doc nvarchar(max)) as rows
138
+
cross apply openjson (doc)
139
+
with ( date_rep datetime2,
140
+
cases int,
141
+
fatal int'$.deaths',
142
+
country varchar(100) '$.countries_and_territories')
143
+
```
144
+
145
+
The `OPENJSON` function parses each line from the JSONL file containing one JSON document per line in textual format.
146
+
122
147
## Use a view
123
148
124
149
You can use views in your queries the same way you use views in SQL Server queries.
0 commit comments