ExportIntoTable
  • 3 Minutes to read
  • Dark
    Light
  • PDF

ExportIntoTable

  • Dark
    Light
  • PDF

Article summary


Exports data from an existing table into a new table.   If a Dataset has been provided, exports just the rows in the Dataset, otherwise exports the whole table.

KeyValueDescription
method"ExportIntoTable"Exports data from an existing table into a new table. 
project"CurrentProject"Name of current project
table"NewTableName"Name of table to create.
fields[][
"field1",
"field2"
"..."
]
Only 1 of fields, all, exportTemplate is allowed.
If all = true, then no field list is required. Otherwise, fields to export must be listed. 
alltrue/falseIf all = true then all fields in the table will be exported. 
exportTemplate"TemplateName"Name of ExportTemplate to use when exporting. ExportTemplates are added to the system using CreateExportTemplate.
The ExportTemplate contains the list of fields to export. Use exportTemplate in place of fields[] or all.
Note: ExportTemplates are not the same as system templates, or dashboard templates
dataSet{}
Optional.  If specified, indicates the subset of records to export.
Note: if dataSet{} contains a high percentage of all records in the table, using ExportIntoTableEx may be faster.
appendtrue/falseOptional.  Default = false.
If true, will append data to existing table.   If false, and table already exists, will raise an error.
incrementaltrue/falseOptional.  Default = false
TODO: What does this do?
ignoreIfNoRowstrue/falseOptional.  Default = false
If true, and the table listed as "table" contains no rows, no error will be raised and the method will be skipped.
Use this to handle scenarios where no rows may be present in a table.
skipIfMissingSourceTabletrue/falseOptional.  Default = false
If true, and the table listed as "table" does not exist, no error will be raised, and the method will be skipped.
Use this when developing scripts that need to handle tables that may or may not be present.
minDiscreteSize0Reserved.  leave as 0.
adjustSymmetrytrue/falseOptional.  Default = false.
If true, if TableName already exists (and append=true), if a field is in the export field list (either as part of fields[], exportTemplate, or all) but is not in the existing Table, the field will be appended, and null data inserted for rows that were already in the table.
This is a way of adding new fields as part of an append to an existing table.
Note: use adjustSymmetry=true with care, as this removes a natural verification that the data being appended to an existing table has the same format as the original, which is often a useful check during script development.    
ctodtrue/falseIf true, an attempt will be made to convert source continuous fields to discrete fields during the export.     This depends on TODO: DiscreteThreshold, datatype and the number of records being exported.
NOTE: Use only when required as this will greatly increase export times.
ignoreIfEmptytrue/falsev5.10.19 and later
optional.
Default = true.
If the resulting table would be empty, by default ExportIntoTable will do nothing and no table will be created.
If false, will create a table with no records and no fields.
See ExportIntoTable - v5.10.13
abandonOnEmptytrue/falsev5.10.19 and later
optional.
Default = false.
By default if the dataset is empty 9(i.e., contains no records), am empty table with fields will be created.
If true, an empty table with no fields will be created.
See ExportIntoTable - v5.10.13
template"template name"name of field template that contains field list to include in export.
(Note: right-click in JSON panel to see list of available templates)


Blank export Function

{
  "method": "ExportIntoTable",
  "project": "",
  "table": "",
  "fields": [],
  "all": false,
  "exportTemplate": "",
  "template": "",
  "dataSet": {},
  "append": false,
  "incremental": false,
  "ignoreIfNoRows": false,
  "abandonOnEmpty": false,
  "skipIfMissingSourceTable": false,
  "allowUnbalanced": false,
  "minDiscreteSize": 0,
  "adjustSymmetry": false,
  "ctod": false,
  "autoUseExtended": false
}


Exporting with a field list

{
  "method": "ExportIntoTable",
  "table": "upserted",
  "append": false,
  "fields": [
    "table1.custid",
    "table1.gender",
    "table1.age",
    "table1.seq"
  ],
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "table1"
      },
      {
        "logic": "remove",
        "stype": "TABLE",
        "entity": "table2"
      }
    ]
  },
  "project": "Upsert"
}


Exporting with a field template

{
  "method": "ExportIntoTable",
  "table": "table_name",
  "append": false,
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "03_HEADER_BIG"
      },
      {
        "logic": "or",
        "stype": "INTRINSIC",
        "intrinsic": {
          "function": "top",
          "params": [
            "10000"
          ]
        }
      }
    ]
  },
  "template": "03-continuous",
  "project": "DataCleanAndInspect"
}




Was this article helpful?