Skip to content

Commit 6bb0d17

Browse files
Add files via upload
1 parent 585d34d commit 6bb0d17

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

azure-storage.ipynb

+11-22
Original file line numberDiff line numberDiff line change
@@ -79,37 +79,26 @@
7979
},
8080
"outputs": [],
8181
"source": [
82+
"declare @response nvarchar(max);\n",
8283
"declare @payload nvarchar(max) = (select * from (values('Hello from Azure SQL!', sysdatetime())) payload([message], [timestamp])for json auto, without_array_wrapper)\n",
83-
"declare @response nvarchar(max), @url nvarchar(max), @headers nvarchar(1000);\n",
84-
"declare @len int = len(@payload)\n",
85-
"\n",
86-
"-- Create the File\n",
87-
"set @url = 'https://blobby.blob.core.windows.net/myblobs/test-me-from-azure-sql.json'\n",
88-
"set @headers = json_object(\n",
89-
" 'x-ms-type': 'file',\n",
90-
" 'x-ms-content-length': cast(@len as varchar(9)),\n",
91-
" 'Accept': 'application/xml')\n",
84+
"declare @url nvarchar(max) = 'https://blobby.blob.core.windows.net/myblobs/test-me-from-azure-sql.json'\n",
9285
"exec sp_invoke_external_rest_endpoint\n",
9386
" @url = @url,\n",
9487
" @method = 'PUT',\n",
95-
" @headers = @headers,\n",
88+
" @headers = '{\"x-ms-blob-type\": \"BlockBlob\", \"Content-Type\":\"application/json\", \"Accept\":\"application/xml\"}',\n",
89+
" @payload = @payload,\n",
9690
" @credential = [filestore],\n",
9791
" @response = @response output\n",
98-
"select cast(@response as xml);\n",
99-
"\n",
100-
"-- Add text to the File\n",
101-
"set @headers = json_object(\n",
102-
" 'x-ms-range': 'bytes=0-' + cast(@len-1 as varchar(9)),\n",
103-
" 'x-ms-write': 'update',\n",
104-
" 'Accept': 'application/xml');\n",
105-
"set @url = 'https://blobby.blob.core.windows.net/myblobs/test-me-from-azure-sql.json'\n",
106-
"set @url += '?comp=range'\n",
92+
"select cast(@response as xml)\n",
93+
"go\n",
94+
"\n",
95+
"declare @response nvarchar(max);\n",
96+
"declare @url nvarchar(max) = 'https://blobby.blob.core.windows.net/myblobs/test-me-from-azure-sql.json'\n",
10797
"exec sp_invoke_external_rest_endpoint\n",
10898
" @url = @url,\n",
109-
" @method = 'PUT',\n",
110-
" @headers = @headers,\n",
111-
" @payload = @payload,\n",
99+
" @headers = '{\"Accept\":\"application/xml\"}',\n",
112100
" @credential = [filestore],\n",
101+
" @method = 'GET',\n",
113102
" @response = @response output\n",
114103
"select cast(@response as xml)\n",
115104
"go"

0 commit comments

Comments
 (0)