validate (Validate a table)

The validate transaction will parse and validate the XML spec input to addtab.

Query string

The query string in the HTTP header must contain the following parameters:

api
Specify the name of the API transaction.
apiversion
Specify the version of the API that should handle the requested transaction.

For the most up-to-date version, use apiversion=3.

uid
Specify a valid 1010data user name.
pswd
Specify a valid password for the 1010data user name provided to the uid parameter.
Note: The pswd value should be the encrypted password returned from the login transaction.
sid
The session ID for the current API session.

This value is returned by the login transaction and must be provided to every transaction (except login).

kill (optional)
Valid values for kill are as follows:
yes
Terminate the existing session and start a new one.
no
Do not terminate the existing session.

If no session exists, a new one will be created. If a session does exist, an error is returned.

Note: If kill=no and a session is active, the system returns an error.
possess
Log in and possess the existing session.
auth
Authenticate with the system but do not kill, possess, or start any session.

The default is yes.

Query String Example

https://www2.1010data.com/gw.k?api=validate&apiversion=3&uid=$UID&pswd=$PSWD&sid=$SID

XML Input to Server

The specifications contain the following elements:

XML Element To Send Description of Sent Element Content Required/ Optional Example
<sync> Specifies if the transaction should wait on the load or continue asynchronously. You can then check the status with the api="status" transaction.
Possible values are:
  • 1 if you want to load synchronously
  • 0 if you want the table to load asynchronously (default)
Optional <sync>1</sync>
<spec> Outer specification element. Contains spec of source files and uploaded table. Required <spec>...</spec>
<table> Table specification element. Contains spec of uploaded table. See Table Tree for XML schema.

Some <spec> fields may be duplicated by <table> fields, in which case, the <table> field will take precedence.

Optional <table>...</table>

List of elements in <spec>

XML Element To Send Description of Sent Element Content Required/ Optional Example
<name> File path of table in 1010data. (
directory1.directory2
    .....directoryn.table
)

If you reference an existing table, PowerLoader will replace it.

Required <name>mytable</name>
<title> Title as it appears in the user interface. Optional <title>my_table_title</title>
<owner> User ID of owner. If omitted, the owner is the user who loads this table. Optional <owner>owner_uid</owner>
<sdesc> Short description of the table. Optional <sdesc>short_description</sdesc>
<ldesc> Long description of the table. Optional <ldesc>long_description</ldesc>
<replace> Replace existing table.

1 for true (default), 0 for false.

Optional <replace></replace>
<link> Link header. Optional <link></link>
<ts> Time-series flag.

Requires that <bord> tags are provided in at least one column.

1 for true, 0 for false (default).

Optional <ts>1</ts>
<temp> Specifies whether the table should be created as a worksheet and exist only in the current session.

1 for true, 0 for false (default).

Optional <temp></temp>
<ignore_null> Replace all nulls in the input with spaces.

1 for true, 0 for false (default).

Optional <ignore_null>1</ignore_null>
filter Attempt to correct malformed data. Possible values are:

0 - don't attempt to correct the input (default)

1 - run with correction of input on

2 - run without correction. If an error occurs, rerun with correction on

Optional
<spec [filter=integer][include_diag_cols=1]>
...
</spec>
include_diag_cols Include diagnostic columns.

1 for true, 0 for false (default).

Optional
<spec [filter=integer][include_diag_cols=1]>
...
</spec>
<users> Specifies users provisioned for table access.

If the <users> element is excluded, only the table owner may access the table. See Users Tree for XML schema and <users> (Top-level wrapper for users tree) for usage details.

private - No user, other than the table's owner, may access the table (default).

list - Only the table's owner and users listed in the users tree may access the table.

inherit - All users that have access to the table's parent directory may access the table.

See List of elements in <users> that follows for more information.

Optional
<users type="private">
    <user>my_uid</user>
</users>
<rectype> Record type.

fixed - fixed length (default)

separated - delimited.
Required <rectype>fixed</rectype>
<sep> Single character delimiter.

tab → "\t"

spc → space

Use binary format instead of string for non-printable characters.

Required if rectype is separated.

<sep>tab</sep>
<eor> End of record delimiter.

none → ""

lf → "\n"

nl → "\n"

crlf → "\r\n"

crnl → "\r\n"

cr → "\r"

Optional <eor>crlf</eor>
<arch> Byte order of data.

little - little-endian order

big - big-endian order
Optional <arch></arch>
<begbytes> Number of bytes to skip at the beginning of file. Optional <begbytes></begbytes>
<endbytes> Number of bytes to skip at the end of file. Optional <endbytes></endbytes>
<begrecs> Number of records to skip in the beginning of file. Optional <begrecs>2</begrecs>
<numrecs> Number of records to load in file. Optional <numrecs></numrecs>
<rowsperseg> Number of rows per segment. Optional <rowsperseg></rowsperseg>
<maskw> The column width you will set for the masking character. The loader will know to continue to read to find the closing `mchr` based on this value. Optional <maskw>1000000</maskw>

Example: |"ITEM_DESC1 |||| ITEMDESC_2, ......, ITEMDESC_N ||||"|.

Here you will need to probably increase `maskw` so that it knows to continue to read until it finds " again.

<mchr> Masking character. If omitted, set "\0". Optional

<mchr>"</mchr>

<thou> Thousands separator (character). Optional <thou></thou>
<intna> Integer NA value (integer). Optional <intna></intna>
<fltna> Float NA value (float). Optional <fltna></fltna>
<inf2na> Coerce infinities to NAs.

1 for true, 0 for false (default).

Optional <inf2na>1</inf2na>
<tcrs> Treat carriage return special.

1 for true, 0 for false (default).

Optional <tcrs>1</tcrs>
<source> Outer source element.

See List of elements in <source> that follows for more information.

Required <source>...</source>
<cols> List of <col> elements, one for each column in the file.
Note: Do not specify <cols> for parquet files, since the column data is already in the file.

See List of elements in <cols> that follows for more information.

Required <cols>...</cols>

List of elements in <source>

XML Element To Send Description Required/ Optional Example
<s3> s3 source information, which includes:

api_key

bucket

format

format can be "csv", "xlsx", or "parquet". The default value is "csv".

format is available in version 17.22 and later.

The user must have the storage account key pre-configured in their account. See Storage account management for instructions on how to add keys to your user account.

Note: When loading parquet files, you should not specify <cols> section, since all column data is already in the parquet file. Additionally, when loading parquet files, <exp> (expression) columns cannot be generated for parquet files.
Required
<s3 api_key="sa_s3_bmathew_master" 
bucket="1010-client-s3" 
format="parquet">
bigTable1MillJ.parquet</s3>
<file> File source information, which includes:

format

format can be "csv", "xlsx", or "parquet". The default value is "csv".

format is available in version 17.22 and later.
Required <file>my_file.csv</file>
<abs> abs source information, which includes:

api_key

storage_account_name

container

format can be "csv", "xlsx", or "parquet". The default value is "csv".

format is available in version 17.22 and later.

The user must have the storage account key pre-configured in their account. See Storage account management for instructions on how to add keys to your user account.

Note: When loading parquet files, you should not specify <cols> section, since all column data is already in the parquet file. Additionally, when loading parquet files, <exp> (expression) columns cannot be generated for parquet files.
Required <abs api_key="my_azure_key" storage_account_name="xxxxxx" container="yyyyyy">load.this.file.gz</abs>

List of elements in <users>

XML Element To Send Description of Sent Element Content Required/ Optional Example
<user> Specifies each user that may access the table.

Used in conjunction with the <users> element when type is list (or if type is omitted).

Each <user> element is nested inside the <users> top-level wrapper.

Required <user>my_uid</user>

List of elements in <col>

XML Element To Send Description of Sent Element Content Required/ Optional Example
<name> Column name (string). Required <name>col_name</name>
<head> Column heading (string). Optional <head>col_title</head>
<width> Column width in the raw file.

Required if rectype is separated, optional if rectype is fixed.

Required/Optional <width>10</width>
<help> Column help (text inside ? marker above column). If you want a newline, use <br>. Optional <help></help>
<skip> Skip this column (boolean).

1 for true, 0 for false (default).

Optional <skip></skip>
<type> Column type (see Column data types). Required <type></type>
<scale> Scale column by this number (integer). Optional <scale></scale>
<case> Force case.

Possible values are lower, upper.

Optional <case>lower</case>
repna Replace special values with natural NAs (boolean).

1 for true, 0 for false (default).

The special values are specified in the na field.

Optional
<col [repna=1] [na=list;of;values]>
...
</col>
na A semicolon-separated list of special values. Optional
<col [repna=1] [na=list;of;values]>
...
</col>
<nowrite> Read column but do not write (boolean).

1 for true, 0 for false (default).

Optional <nowrite></nowrite>
<order> Column placement relative to other columns (integer). Optional <order></order>
<exp> Expression to use if the data type is exp (see Column data types).
Note: <exp> columns cannot be generated for parquet files.
Optional <exp></exp>
<bord> Time series break order (integer). Required for at least one column if Time-series flag is set to true (<ts>1</ts>). The number provided here is the relative segmentation order of this column relative to other columns with the <bord> tag. The column that denotes time should have the largest number in the sequence. Optional <bord></bord>
<fix> Fix column towards left-hand side (boolean).

1 for true, 0 for false (default).

Optional <fix></fix>
<format> Column format (see Column display format types). Required
<format>
<width></width>
</format>
<cmp> Optional <cmp></cmp>

List of elements in each <col> <format>

XML Element To Send Description of Sent Element Content Required/ Optional Example
<type> The column's display format (see Column display format types). Required <type></type>
<width> The width of the column in the GUI. Required <width></width>
<dec> The number of decimal places to show Required <dec></dec>

XML input example

<in>
<spec>
   <source>
    <file>mytable20060101.txt</file>
    <file>mytable20060201.txt</file>
  </source>
  <name>mycompany.mytable</name>
  <title>Mytable 2006</title>
  <sdesc>short description of the table</sdesc>
  <ldesc>long description of table</ldesc>
  <link>FOO</link>
  <users>
    <user>user1</user>
    <user>user2</user>
  </users>
  <rectype>fixed</rectype>
  <eor>crlf</eor>
  <cols>
  <col>
      <name>deal</name>
      <width>12</width>
      <head>Deal ID</head>
      <type>int</type>
      <format>
          <type>nocommas</type>
          <width>3</width>
          <dec>0</dec>
      </format>
  </col>
  <col>
    <name>date</name>
    <width>55</width>
    <head>Distribution Date</head>
    <type>yyyymmdd</type>
    <format>
      <type>date</type>
      <width>8</width>
    </format>
  </col>
  <col>
    <name>loan</name>
    <width>21</width>
    <head>Loan`Number</head>
    <type>int</type>
    <exp>loan+2</exp>
  </col>
  </cols>
</spec>
</in>

XML response from server

A successful validate produces the following result:

XML Element Returned Description of Returned Element Content
<rc> Return code
<msg> Message from the system

XML Response Example

<rc>0</rc>
<msg>validate successful</msg>