extractTextSchema

Syntax

extractTextSchema(filename, [delimiter], [skipRows=0])

Arguments

filename the input data file name with its absolute path.

delimiter a STRING scalar indicating the table column separator. It can consist of one or more characters, with the default being a comma (‘,’).

skipRows is an integer between 0 and 1024 indicating the rows in the beginning of the text file to be ignored. The default value is 0.

Details

Generate the schema table for the input data file. The schema table has 2 columns: column names and their data types.

Note: From version 1.30.22 onwards, function extractTextSchema supports a data file that contains a record with multiple newlines.

Examples

$ n=1000000
$ timestamp=09:30:00+rand(18000,n)
$ ID=rand(100,n)
$ qty=100*(1+rand(100,n))
$ price=5.0+rand(100.0,n)
$ t1 = table(timestamp,ID,qty,price)
$ saveText(t1, "C:/DolphinDB/Data/t1.txt")
$ schema=extractTextSchema("C:/DolphinDB/Data/t1.txt");
$ schema;

name

type

timestamp

SECOND

ID

INT

qty

INT

price

DOUBLE