Fork me on GitHub

TSVRead

Signatures

TSVRead(VARCHAR path);
TSVRead(VARCHAR path, VARCHAR tableName);

Description

Reads the file specified by path as a Tab-Separated Values (TSV) file and copies its contents into a new table tableName in the database.

If the tablename parameter is not specified, then the resulting table has the same name as the TSV file.

Example

In following example, we have a TSV file, which is stored here : /home/user/GoT.tsv. This file is structured as follow.

NAME	FIRSTNAME	PLACE
Stark	Arya	Winterfell
Lannister	Tyrion	Westeros
Snow	Jon	Castle Black
Baelish	Peter	King's Landing

Now we can convert this file into a table

CALL TSVRead('/home/user/GoT.tsv', 'GameOfThrones');
SELECT * FROM GameOfThrones ;
-- Answer:
-- |   NAME    | FIRSTNAME |     PLACE      |
-- |-----------|-----------|----------------|
-- | Stark     | Arya      | Winterfell     |
-- | Lannister | Tyrion    | Westeros       |
-- | Snow      | Jon       | Castle Black   |
-- | Baelish   | Peter     | King's Landing |
See also