joe
joe

Reputation: 21

how to create virtual dataset through rest api in superset, only able to create physical dataset

anyone knows how to create a virtual dataset through rest api in superset. able to create physical dataset using this json parameters.

{ "database": 0, "owners": [ 0 ], "schema": "string", "table_name": "string" }

the problem is here , no parameter options for passing virtual table querys, no details about the virtual table in superset swagger documentation.

while i can create physical and virtual dataset from dashboard side. thankyou

Upvotes: 2

Views: 1007

Answers (1)

lazuardi_fenjano
lazuardi_fenjano

Reputation: 101

I`ve solve this by do this

Import this to your Raw text in Postman

curl 'http://192.168.10.107:8088/superset/sqllab_viz/' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-EN,en;q=0.9,en-US;q=0.8,en;q=0.7' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryVmkUTQRE8ZgVIAfU' \
  -H 'Cookie: session=.eJyFkd1qwzAMRl9l-Do0lm05dl5llCBb8hpWluC4G6P03eey3Q90Jb5z0M9dLaXKcVFzqzcZ1LKymlUx5ApTBC8sgZ1AKRSTKRkgFA_eiaccHDuDRmKCFCyk3hLSBnUyaCNYRm3dhLmIs8-WC8g2iTElkEPnJ0BK00SeDSbNGrXOOiOIUYPKRy1L297l4zmPoEHKKZkAFLFEy84Xp8vEkEtIxMAWCTt33TJdpTMdHNRGt9Z3u6uXpuZXFXKyXeUIiWw3maQpRBczx8lZ8J1Q58cftux1-1xZapd9bZX3fqejJ3Z6k-WyHm2r30_ppbV9HkeI5gQ-nED3muagQxjrdpVjvPbs2MF_g8JrGwHUeVC3Q-rvLwDV4wcIjHo-.Y1ULLQ.PlsmVk7EAYDhMh4FXWDw-2BuOms' \
  -H 'DNT: 1' \
  -H 'Origin: http://192.168.10.107:8088' \
  -H 'Referer: http://192.168.10.107:8088/superset/sqllab/' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36' \
  -H 'X-CSRFToken: ImZlNTI1YWNiYjI4MWE5NWY5M2Q0NmY0MGY3ZDFjZjhiYWQxZDM1YTUi.Y1ULZg.IdeebPxxB1WPAnzMM_shgAaP1Sk' \
  --data-raw $'------WebKitFormBoundaryVmkUTQRE8ZgVIAfU\r\nContent-Disposition: form-data; name="data"\r\n\r\n{"schema":"superset","sql":"SELECT KODE_RS , KELAS_RS , KELAS_RAWAT , ADMISSION_DATE FROM rsa_januari_2021 WHERE  ADMISSION_DATE  = \'21/01/2021\'  LIMIT 10","dbId":3,"datasourceName":"VirtualDatasetTest1","columns":[{"name":"SOME_TEXT1","type":"BLOB","is_date":false},{"name":"SOME_TEXT2","type":"BLOB","is_date":false},{"name":"SOME_TEXT3","type":"LONGLONG","is_date":false},{"name":"SOME_TEXT4","type":"BLOB","is_date":false}]}\r\n------WebKitFormBoundaryVmkUTQRE8ZgVIAfU--\r\n' \
  --compressed \
  --insecure

so After That you can request Post in Postman. Note. you must copy as Curl(bash) in your web inspector

and after you run this in postman you should create virtual dataset named "VirtualDatasetTest1"

I hope this help the other.

Upvotes: 0

Related Questions