Table Commands
The following commands are used to interact with the data tables on the matching engine.
tbllist
The ‘tbllist’ command returns a list of all tables loaded in the matching engine.
Example output:
List: GENERIC DBDESCRIPTOR: std LAYOUT: CHECKPOINT_STATUS: Never Checkpointed TRAN_ID: 0 TRAN_OBJ_STATE: 1 DBINFO: DBNUMFIELDS: 3 FIELDNAMES: ["FirstName","LastName","Age"] FIELDTYPES: [ 5, 5, 5] FIELDBYTECOUNTS: [ 66, 74, 26] FIELDCHARCOUNTS: [ 66, 74, 26] CHARMAPS: ["=STD=","=STD=","=STD="] DBGIPFILTER: true DBGIPGPU: false DBSORTFILTER: false DBPSIFILTER: false DBNUMRECORDS: 13 DBKEYTREEKBYTES: 12 DBRECFIELDKBYTES: 0 DBHEADERKBYTES: 1323 DBIDXTOTALKBYTES: 334 DBTOTALKBYTES: 3741 PROCTOTALKBYTES: 415268 TABLE_TYPE: Standard
tblcreate -table <name> -file <def-file>
The tblcreate command is used to create a table. With this command, you can define the following information:
-
Field names.
-
Field types.
-
Field maps.
-
Field indexes.
The tblcreate command has two arguments:
-
name the name of the table
-
<def-file> the file name of a table definition file
The table definition file contains one line for each field in the table with each line having the comma-separated values as shown below:
Fieldname,Field type,Field map[, index file][,index file]
Example of a Table Definition File:
col1,5,=STD=,C:\Netrics\Data\addPIndex\state.txt,C:\Netrics\Data\addPIndex\state2.txt col2,5,=STD= col3,5,=STD= col4,5,=STD=,C:\Netrics\Data\addPIndex\state3.txt col5,5,=STD= col6,5,=STD=
Each row defines a different field and field name. A field type and a field map must also be specified.
-
FLDTYPE_ATTRS - 15
-
FLDTYP_SRCHDATE - 11
-
FLDTYP_DATE - 10
-
FLDTYP_DATETIME - 12
-
FLDTYP_FLOAT - 8
-
FLDTYP_INT - 6
-
FLDTYP_SRCHTEXT - 5
-
FLDTYP_TEXT - 4
tblcreate is available for table creation. For more information about creating a map, see -cmd mapcreate.tblload –table <name> -file <csv-file> [-settableinfo <text>] [<csv-options>]
The tblload command creates a table and loads a csv file into the matching engine.
| Options | Description |
|---|---|
|
name |
Name of the table to be created. This is required |
|
csv-file |
Name of a CSV file containing the records to be loaded. The first line must be a header line defining the names of the fields of the file. This is required. |
|
text |
Optional arbitrary text associated with this table. |
For the tblload command, specify –fieldnamesfirst in the csv-options arguments.
csv-options
csv-options is a collection of arguments used to define the format of the CSV file containing the records. The following options are common to a number of commands:
| Options | Description |
|---|---|
|
-encoding <char-set> |
The character set encoding of the file. Valid values are “latin1” and “UTF-8”. The default is “latin1”. |
|
-domaxwork |
If Records in the CSV file with formatting errors or duplicate keys are quietly ignored. |
|
-leadingkey |
The first field in each data record is assumed to be the key field for the record. This field is unnamed and does not appear in any header record of field names. |
|
-initialkey <n> |
If keys are generated automatically the key sequence starts with n. Default: Zero. |
|
-fieldnamesfirst |
The first line of the CSV file is a header line defining the names of each field. Default: No field name header line. |
|
-fieldtypesfirst |
The first line of the CSV file (after any field name header line) defines the field types for each field. The field types are integer values as listed in “About Field Types” above. Default: No field types header line. |
|
-isparent |
The table is created as a parent table. Default: Table is not a parent table. |
|
-parenttable <table-name> |
This is a child table. The table-name given must be the name of an existing parent table. It is an error to provide this option if -isparent is given. Default: Table is not a child table. |
|
-keyfieldindex <n> |
The index (zero based) of the field that is to be used as the record key. This field is not loaded as a data field. |
|
-keyfieldname <name> |
The name of the field that is to be used as the record key. This field is not loaded as a data field. |
|
-parentkeyfield <name> |
The name of the field that is used as the parent key of a child table. This field is not loaded as a data field. This is required for child tables, that is, if the –parenttable option is given. It is not allowed for non-child tables. |
Only one of –leadingkey, -keyfieldindex or –keyfieldname may be specified. If none are specified keys are generated automatically. The –initialkey argument is only used if keys are being generated automatically.
fastload -table <name> -file <csv-file> [-create|-replacenotadd] <csv-options>
Use the fastload command to significantly decrease table load time. Options:
| Options | Description |
|---|---|
|
name |
Name of the table to be created. This is required. |
|
csv-file |
Name of a CSV file containing records to be loaded. This file must be accessible by the Matching Engine. This is required. |
|
-create |
If present a new empty table is created. Any existing table with the same name is deleted. The default is to assume the table already exists. |
|
-replacenotadd |
If this is specified records in an existing table are replaced with those from the CSV file instead of being added as new records. The CSV file must contain record keys. |
|
<csv-options> |
CSV file format options as defined for tblload. |
tbldelta –table <name> -file <delta-file> -fieldkeynumber <field-number>
The tbldelta command will process a delta file against an existing table. The delta file, currently only CSV is supported, must have a 1 character column in the first position that contains (i/u/d) i=insert, u=update, d=delete. The delta file must contain the key value to identify the action record which is identified by the –fieldkeynumber argument. The –fieldkeynumber value is zero based.
tbldelete –table <name>
Use the tbldelete command to delete an existing table from the matching engine.
tblmove –oldtable <name> -newtable <new-name>
Use the tblmove command to rename a table. This command is typically used to instantly replace an existing table with a freshly loaded version. Pre-load a table that is to be updated with a temporary name and then ‘move’ it to the existing table. This update/replace methodology insures that there is no down time for the active table. Queries being run against the –newtable will be queued until the tblmove operation completes.
tbldump –table <name> [-file <dump-output-file>]
The tbldump command will stream the entire contents of a table to the console (not recommended for large tables above 10K records) or to a file if the –file option is given. The output varies depending on what the destination is. Output to the console will be prefaced with a ‘key=’ identifier. Output to a file will not contain a key identifier and will mirror the layout in the table. The original table will not be affected.