sniff_csv¶
- getml.sqlite3.sniff_csv(fnames, table_name, header=True, num_lines_sniffed=1000, quotechar='"', sep=',', skip=0, colnames=None)[source]¶
Sniffs a list of csv files.
- Args:
- fnames (List[str]):
The list of CSV file names to be read.
- table_name (str):
Name of the table in which the data is to be inserted.
- header (bool):
Whether the csv file contains a header. If True, the first line is skipped and column names are inferred accordingly.
- num_lines_sniffed (int, optional):
Number of lines analyzed by the sniffer.
- quotechar (str, optional):
The character used to wrap strings. Default:”
- sep (str, optional):
The separator used for separating fields. Default:,
- skip (int, optional):
Number of lines to skip at the beginning of each file (Default: 0).
- colnames(List[str] or None, optional):
The first line of a CSV file usually contains the column names. When this is not the case, you can explicitly pass them. If you pass colnames, it is assumed that the CSV files do not contain a header, thus overriding the ‘header’ variable.
- Returns:
- str:
Appropriate CREATE TABLE statement.