浏览代码

[docs] Add FS operations for ADLS client via Hue shell

Harsh Gupta 4 年之前
父节点
当前提交
56aaecacb7
共有 1 个文件被更改,包括 33 次插入6 次删除
  1. 33 6
      docs/docs-site/content/developer/api/python/_index.md

+ 33 - 6
docs/docs-site/content/developer/api/python/_index.md

@@ -37,13 +37,13 @@ And finally launch the shell by:
 
 ### S3
 
-Interact directly with S3 by first getting a client:
+Interact directly with S3 by first getting the client:
 
     from desktop.lib.fsmanager import get_client
 
-    s3fs = get_client('default', 's3a', 'romain')
+    s3fs = get_client('default', 's3a', 'csso_hueuser')
 
-Then grab a key:
+Then grab the key:
 
     k = s3fs._get_key('s3a://gethue/')
     k.exists()
@@ -67,11 +67,38 @@ Or perform various FS operations:
 
 ### ADLS
 
-    from desktop.lib.fsmanager import get_client
 
-    fs = get_client('default', 'abfs', 'romain')
+Interact directly with ADLS by first getting the client:
+
+    from desktop.lib.fsmanager import get_client
 
-    fs.stats('https://gethue.blob.core.windows.net/data')
+    fs = get_client('default', 'abfs', 'csso_hueuser')
+
+Perform various FS operations:
+
+    # Stats
+    fs.stats('abfs://data/user/csso_hueuser/demo_dir')
+    
+    # List
+    fs.listdir('abfs://data/user/csso_hueuser/demo_dir')
+    
+    # Create directory
+    fs.mkdir('abfs://data/user/csso_hueuser/new_dir')
+    
+    # Create file
+    fs.create('abfs://data/user/csso_hueuser/demo_dir/newfile.txt')
+
+    # Create file with write data
+    fs.create('abfs://data/user/csso_hueuser/demo_dir/demo_file.txt', data='Hello world!')
+    
+    # Read
+    fs.read('abfs://data/user/csso_hueuser/demo_dir/demo_file.txt')
+    
+    # Delete path (can be file or empty directory)
+    fs.remove('abfs://data/user/csso_hueuser/demo_dir/demo_file.txt')
+    
+    # Delete directory with recursive as true
+    fs.rmtree('abfs://data/user/csso_hueuser/demo_dir')
 
 ## Users