This is an old revision of the document!


Administration: Omnidex Fundamentals

Raw Data Files: Delimited Files

Record Layouts

The record layout described in the CREATE TABLE statement must exactly match the order of columns in the data file. Care must also be taken with binary columns to insure that the character content in the data file can be legitimately converted to the binary datatype declared in the table. If these record layouts do not match, Omnidex will have problems reading the data from the delimited file.

In the CREATE TABLE statement, the record layout is specified using the COLUMN clause. The datatypes and lengths for these columns can be nearly any datatype supported by Omnidex. The only exceptions are the VARCHAR and CLOB datatypes, as these require that the underlying data also include stored data lengths. With raw data files, use STRING and CHARACTER datatypes instead.

CREATE TABLE          "STATES"
 options              "DELIMITED COLUMN=',' RECORD='\r\n'"
 physical             "dat/states.dat"
 (
  "STATE"             CHARACTER(2),                
  "DESCRIPTION"       STRING(31),                 
  "STATE_CODE"        CHARACTER(2),                
  "REGION"            CHARACTER(2),                
  "COUNTRY"           CHARACTER(2),                
  "TAX_RATE"          FLOAT                       
 )
 IN                   "simple.xml";

Most raw data files are accompanied by some kind of record layout that can be used to construct the CREATE TABLE statement. For those that do not, the DUMP DELIMITED FILE command in OdxSQL can be helpful. This command will dump each line of the file in hex, honoring the line delimiters specified.

> dump delimited file dat/states.dat

File dump for dat/states.dat

Record length [256]: 44

dat/states.dat is 3.3K and has 76 rows

Rec #, Previous, Next, First, Last, or Quit:
Filename: dat/sta.dat  Record: 1  Offset: 0
00000-00015:   41414172 6d656420 466f7263 65732041     AAArmed Forces A
00016-00031:   6d657269 63617300 00000000 00000000     mericas.........
00032-00043:   00002020 41465553 00000000              ..  AFUS....
Rec #, Previous, Next, First, Last, or Quit:
Filename: dat/sta.dat  Record: 2  Offset: 44
00000-00015:   41454172 6d656420 466f7263 65732045     AEArmed Forces E
00016-00031:   75726f70 652f4166 72696361 00000000     urope/Africa....
00032-00043:   00002020 41465553 00000000              ..  AFUS....
Rec #, Previous, Next, First, Last, or Quit:
Filename: dat/sta.dat  Record: 3  Offset: 88
00000-00015:   41504172 6d656420 466f7263 65732050     APArmed Forces P
00016-00031:   61636966 69630000 00000000 00000000     acific..........
00032-00043:   00002020 41465553 00000000              ..  AFUS....

Omnidex cannot verify that the record layouts exactly match, so it is always wise to retrieve a few rows and visually inspect that the column definition and the data file line up properly.

Additional Resources

See also:

 
Back to top
admin/basics/rawdata/delimited/layout.1299099327.txt.gz ยท Last modified: 2012/10/26 14:57 (external edit)