Examples

Create a Virtual Table

curl -d "[\"CREATE VIRTUAL TABLE /services/databases/PUB3/link1 SET TARGET /shared/examples/ds_orders/tutorial/customers SET ANNOTATION 'this is a published table'\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Create a Virtual Procedure

curl -d "[\"CREATE VIRTUAL PROCEDURE /services/databases/PUB3/link2 SET TARGET /shared/examples/LookupProduct SET ANNOTATION 'this is a published procedure'\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Rename & Relocate a Virtual table

//only rename
curl -d "[\"ALTER VIRTUAL TABLE /services/databases/PUB3/link1 RELOCATE TO /services/databases/PUB3/renamedlink1 SET ANNOTATION 'altered virtual table'\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"
 
//Both rename and relocate
curl -d "[\"ALTER VIRTUAL TABLE /services/databases/PUB3/link1 RELOCATE TO /services/databases/publishedDB/renamedlink1 SET ANNOTATION 'altered virtual table'\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Unset annotation

curl -d "[\"ALTER VIRTUAL TABLE /services/databases/PUB3/link1 SET ANNOTATION NULL\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Alter Virtual Table Target

curl -d "[\"ALTER VIRTUAL TABLE /services/databases/PUB3/link1 SET TARGET /shared/examples/ds_orders/tutorial/employees SET ANNOTATION 'altered virtual procedure with table target'\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Delete Virtual Table

curl -d "[\"DROP VIRTUAL TABLE /services/databases/PUB3/link1\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Delete Virtual Procedure IF EXISTS

curl -d "[\"DROP VIRTUAL PROCEDURE IF EXISTS /services/databases/PUB3/link2\"]"
    -u "admin:admin"
    -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke"
    -H "Content-Type:application/json"

Get Virtual Table Properties

curl -u "admin:admin" -X POST "http://localhost:9400/rest/execute/v1/actions/query/invoke" -H "Content-Type:application/json"
    -d "{\"query\":\"SELECT * FROM model.ALL_RESOURCE_PROPERTIES props
                WHERE metadata_id = (SELECT table_id FROM model.ALL_TABLES where table_name = 'link1' and parent_path='/services/databases/publishedDB')\",
        \"standardSQL\":true}"