FILE_TABLE

Signature

FILE_TABLE(VARCHAR path, VARCHAR tableName);

Description

Uses an appropriate driver to open the file at path and create a linked (read-only) table tableName. This table is always in-sync with the source file.

Currently supported:

If the source file is moved or deleted, the special table will still exist but will be empty.

Examples

Basic syntax

CALL FILE_TABLE('/home/user/myshapefile.shp', 'tableName');
CALL FILE_TABLE('/home/user/dbase.dbf', 'tableName');

Auto detect

The following two examples show that the driver to be used is automatically detected from the file extension:

CALL FILE_TABLE('/home/user/COMMUNE.DBF', 'commune');
SELECT * FROM commune LIMIT 2;

Answer:

NAME

CODE

Puceul

44138

Sévérac

44196

CALL FILE_TABLE('/home/user/COMMUNE.SHP', 'commune44');
SELECT * FROM commune44 LIMIT 2;

Answer:

THE_GEOM

NOM

CODE

MULTIPOLYGON(((350075.2 6719771.8, … 350075.2 6719771.8)))

Puceul

44138

MULTIPOLYGON(((317341.5 6727021, … 317341.5 6727021)))

Sévérac

44196

See also