{Denodo}スケジューラジョブ(リストソースのパラメータ化クエリ + CSV exporter)

 

https://community.denodo.com/docs/html/browse/8.0/jp/scheduler/administration/creating_and_scheduling_jobs/configuring_new_jobs/vdp_extraction_section#

LIST タイプの場合、値を割り当てることができるのは 1 つの変数のみです。

 

-- パラメータ化クエリ
select count(*) from @TABNAME;

-- 入力リスト
db01.b_tab1,
db01.b_tab2,
db01.b_tab3,

 

-- CSVファイル出力先
C:\Denodo\DenodoPlatform8.0\work\scheduler\data\csv

 

-- 1. ジョブ作成

※入力リストに改行があると改行部分がエスケープされ不正なJSONとみなされる

curl -X POST "http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects/107/jobs?uri=%2F%2Flocalhost%3A8000" -H "accept: application/json" -H "authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -d "{ \"type\" : \"VDP\", \"name\" : \"job01\", \"draft\" : false, \"disabled\" : false, \"description\" : \"job01\", \"extractionSection\" : { \"type\" : \"VDP\", \"dataSourceID\" : 113, \"extractionData\" : { \"parameterizedQuery\" : \"select count(*) from @TABNAME;\", \"fields\" : [ { \"fields\" : [ { \"queryParamName\" : \"TABNAME\" } ], \"source\" : { \"type\" : \"list\", \"values\" : \"db01.b_tab1,db01.b_tab2,db01.b_tab3,\", \"separator\" : \",\" } } ], \"sourcesNotChange\" : true } }, \"exportationSection\" : { \"exportAsTransaction\" : false, \"exporters\" : [ { \"type\" : \"CSV\", \"originalIndex\" : 0, \"fileName\" : \"output.csv\", \"encoding\" : \"UTF-8\", \"overwriteFile\" : true, \"appendFile\" : false, \"createNewFile\" : false, \"allowEmptyFile\" : true, \"exportInternalFields\" : false, \"exportOnlyMappings\" : false, \"filter\" : \"NONE\", \"separator\" : \",\", \"includeHeader\" : false, \"quoteAllFields\" : false, \"quoteFieldsOption\" : \"WHEN_REQUIRED\" } ] }, \"handlerSection\" : { }, \"retrySection\" : { }, \"triggerSection\" : { \"triggers\" : [ { \"type\" : \"cron\", \"cronExpression\" : \"0 0 23 * * ?\" } ] }, \"reportSection\" : { \"reportConfig\" : { \"maxIndividualReports\" : 100, \"reportOnlyErrors\" : true } }}"

 

-- 2. 特定プロジェクトのジョブ一覧

curl -X GET "http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects/107/jobs?uri=%2F%2Flocalhost%3A8000" -H "Authorization: Basic YWRtaW46YWRtaW4="

curl -s -X GET "http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects/107/jobs?uri=%2F%2Flocalhost%3A8000" -H "Authorization: Basic YWRtaW46YWRtaW4=" | findstr " \"id\" \"name\" "

 

 

-- 3. 特定プロジェクトの特定ジョブ確認

curl -X GET "http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects/107/jobs/122?uri=%2F%2Flocalhost%3A8000" -H "Authorization: Basic YWRtaW46YWRtaW4="

{
  "type" : "VDP",
  "id" : 122,
  "projectId" : 107,
  "projectName" : "db01",
  "name" : "job01",
  "draft" : false,
  "disabled" : false,
  "description" : "job01",
  "extractionSection" : {
    "type" : "VDP",
    "dataSourceID" : 113,
    "extractionData" : {
      "parameterizedQuery" : "select count(*) from @TABNAME;",
      "fields" : [ {
        "fields" : [ {
          "queryParamName" : "TABNAME"
        } ],
        "source" : {
          "type" : "list",
          "values" : "db01.b_tab1,db01.b_tab2,db01.b_tab3,",
          "separator" : ","
        }
      } ],
      "sourcesNotChange" : true
    }
  },
  "exportationSection" : {
    "exportAsTransaction" : false,
    "exporters" : [ {
      "type" : "CSV",
      "originalIndex" : 0,
      "fileName" : "output.csv",
      "encoding" : "UTF-8",
      "overwriteFile" : true,
      "appendFile" : false,
      "createNewFile" : false,
      "allowEmptyFile" : true,
      "exportInternalFields" : false,
      "exportOnlyMappings" : false,
      "filter" : "NONE",
      "separator" : ",",
      "includeHeader" : false,
      "quoteAllFields" : false,
      "quoteFieldsOption" : "WHEN_REQUIRED"
    } ]
  },
  "handlerSection" : { },
  "retrySection" : { },
  "triggerSection" : {
    "triggers" : [ {
      "type" : "cron",
      "cronExpression" : "0 0 23 * * ?"
    } ]
  },
  "reportSection" : {
    "reportConfig" : {
      "maxIndividualReports" : 100,
      "reportOnlyErrors" : true
    }
  }
}

 

-- 4. ジョブ実行

curl -X PUT "http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects/107/jobs/122/status?uri=%2F%2Flocalhost%3A8000" ^
-H  "Authorization: Basic YWRtaW46YWRtaW4=" ^
-H "Content-Type: application/json" ^
-d "{\"action\":\"start\"} "