Skip to content

Pre-release documentation

This describes Beacon 2.0.0-rc3, a release candidate. Behavior documented here may still change before 2.0.0 ships, and some of it is not in any released build yet. For the current stable release, see the 1.8.0 documentation.

CREATE EXTERNAL TABLE

sql
CREATE EXTERNAL TABLE ocean_profiles
STORED AS PARQUET
LOCATION 'profiles/'

An external table is a SQL table over files in the storage of Beacon. After you register it, you can query it with SELECT and JOIN. A VIEW can also reference it. Beacon reads the files on demand. It does not copy them. A table definition survives a restart.

Syntax

sql
CREATE [OR REPLACE] EXTERNAL TABLE [IF NOT EXISTS] <table_name>
STORED AS <format>
LOCATION '<path>'
[PARTITIONED BY (<col>, ...)]

Beacon resolves LOCATION against its storage root. Give a folder or a glob pattern:

sql
-- Entire folder
CREATE EXTERNAL TABLE argo STORED AS NC LOCATION 'argo/'

-- Explicit glob
CREATE EXTERNAL TABLE argo STORED AS NC LOCATION 'argo/**/*.nc'

Formats

STORED ASFile types
PARQUET.parquet
GEOPARQUET.geoparquet
NC.nc
ZARRZarr v3 (zarr.json)
ATLASAtlas array store (atlas.json)
CSV.csv
ARROWArrow IPC (.arrow, .feather)
TIFFGeoTIFF / Cloud-Optimized GeoTIFF
BBFBeacon Binary Format
DELTADelta Lake table directory (_delta_log/)
ICEBERGApache Iceberg table directory (metadata/)
POSTGRESExternal PostgreSQL table (federated)
MYSQLExternal MySQL table (federated)

DELTA points at an existing Delta Lake table directory. It also supports time travel and INSERT INTO. ICEBERG points to an Apache Iceberg table directory that already exists. It supports time travel. It reads each new snapshot. It is read-only. REMOTE federates a table on another Beacon server. See Remote Tables. POSTGRES and MYSQL federate a table in an external SQL database. See SQL Databases. Their LOCATION is the remote table name. The connection details go in OPTIONS, with an encrypted password.

A Zarr table must point at a zarr.json entry file. An Atlas table must point at an atlas.json marker:

sql
CREATE EXTERNAL TABLE sst STORED AS ZARR LOCATION 'sst/*/zarr.json'

CREATE EXTERNAL TABLE sensor STORED AS ATLAS LOCATION 'sensor/atlas.json'

GEOPARQUET reads Parquet files. Beacon decodes their geometry columns to native GeoArrow. See GeoParquet in File Formats for the read behaviour and for geometry queries.

IF NOT EXISTS

Beacon skips the registration if the table name already exists. Beacon returns no error:

sql
CREATE EXTERNAL TABLE IF NOT EXISTS argo
STORED AS NC
LOCATION 'argo/**/*.nc'

OR REPLACE

Register the table again. Beacon overwrites the existing definition:

sql
CREATE OR REPLACE EXTERNAL TABLE argo
STORED AS NC
LOCATION 'argo/**/*.nc'

PARTITIONED BY

Your files can use Hive-style directories such as year=2024/month=01/.... Declare the partition columns. Beacon can then prune them at query time:

sql
CREATE EXTERNAL TABLE observations
STORED AS PARQUET
LOCATION 'obs/'
PARTITIONED BY (year, month)
sql
SELECT * FROM observations WHERE year = 2024 AND month = 6

DROP TABLE

DROP TABLE removes a table from the catalog. Beacon does not delete the files.

sql
DROP TABLE argo

DROP TABLE IF EXISTS argo

Querying and inspecting

sql
SHOW TABLES;

DESCRIBE ocean_profiles;

The External Tables setup guide gives an example for each format. It also shows the HTTP API that lists the tables.

Released under the AGPL-3.0 License.