Skip to content

Commit 194a66e

Browse files
authored
Merge pull request #122689 from thinkall/patch-1
Update code for connect with linked service
2 parents a226c7e + c1abda9 commit 194a66e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

articles/synapse-analytics/spark/tutorial-spark-pool-filesystem-spec.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ FSSPEC can read/write ADLS data by specifying the linked service name.
105105
import fsspec
106106
import pandas
107107
108-
adls_account_name = '' #Provide exact ADLS account name
109-
sas_key = TokenLibrary.getConnectionString(<LinkedServiceName>)
108+
linked_service_name = '' #Provide exact Linked Service Name
110109
111-
fsspec_handle = fsspec.open('abfs[s]://<container>/<path-to-file>', account_name = adls_account_name, sas_token=sas_key)
110+
fsspec_handle = fsspec.open('abfs[s]://<container>/<path-to-file>', storage_options={'linked_service': linked_service_name})
112111
113112
with fsspec_handle.open() as f:
114113
df = pandas.read_csv(f)
@@ -117,17 +116,16 @@ FSSPEC can read/write ADLS data by specifying the linked service name.
117116
import fsspec
118117
import pandas
119118
120-
adls_account_name = '' #Provide exact ADLS account name
119+
linked_service_name = '' #Provide exact Linked Service Name
121120
122121
data = pandas.DataFrame({'Name':['Tom', 'nick', 'krish', 'jack'], 'Age':[20, 21, 19, 18]})
123-
sas_key = TokenLibrary.getConnectionString(<LinkedServiceName>)
124122
125-
fsspec_handle = fsspec.open('abfs[s]://<container>/<path-to-file>', account_name = adls_account_name, sas_token=sas_key, mode="wt")
123+
fsspec_handle = fsspec.open('abfs[s]://<container>/<path-to-file>', storage_options={'linked_service': linked_service_name}, mode="wt")
126124
127125
with fsspec_handle.open() as f:
128126
data.to_csv(f)
129127
```
130-
128+
131129
## Upload file from local file system to default ADLS storage account of Synapse workspace
132130

133131
FSSPEC can upload a file from the local file system to a Synapse workspace default ADLS storage account.

0 commit comments

Comments
 (0)