Files
floci/docs/services/glue.md
T
Hector Ventura 1ddbec0efb feat(athena): real SQL execution via floci-duck DuckDB sidecar (#584)
* feat(athena): real SQL execution via floci-duck DuckDB sidecar

  - Lazy-start floci/floci-duck:latest on first StartQueryExecution call;
    reuse the running container for all subsequent queries
  - Inject Glue tables as CREATE OR REPLACE VIEW statements via setup_sql
    before the user SQL so DDL runs outside the COPY(...) wrapper
  - SerDe-aware format inference: inferReadFunction now checks
    SerdeInfo.SerializationLibrary in addition to InputFormat, so standard
    AWS JSON tables (TextInputFormat + JsonSerDe) map to read_json_auto
  - ImageCacheService: skip Docker Hub pull when image is already present
    locally, preventing local builds from being overwritten
  - Add AthenaIntegrationTest (5 unit integration tests)
  - Add AthenaTest and DataLakeTest SDK compatibility tests
  - Update docs: athena.md (full rewrite), glue.md, README, CHANGELOG

* fix: docker image check fix
2026-04-25 08:28:20 -05:00

2.6 KiB

Glue

Protocol: JSON 1.1 Endpoint: http://localhost:4566/

Floci emulates the AWS Glue Data Catalog, allowing you to manage metadata for your data lake locally.

Supported Actions

Databases

CreateDatabase · GetDatabase · GetDatabases · DeleteDatabase · UpdateDatabase

Tables

CreateTable · GetTable · GetTables · DeleteTable · UpdateTable

Partitions

CreatePartition · BatchCreatePartition · GetPartition · GetPartitions · DeletePartition

Integration with Athena

The Glue Data Catalog is automatically used by Athena to resolve table names to S3 locations and formats. When you submit an Athena query, Floci reads all Glue tables for the target database and generates DuckDB views on top of the underlying S3 objects before executing the SQL.

The DuckDB read function is selected based on the table's StorageDescriptor.InputFormat and StorageDescriptor.SerdeInfo.SerializationLibrary:

Condition DuckDB function
InputFormat or SerializationLibrary contains parquet read_parquet
InputFormat or SerializationLibrary contains json read_json_auto
InputFormat contains hive read_json_auto
Anything else read_csv_auto

Example

export AWS_ENDPOINT_URL=http://localhost:4566

# Create a database
aws glue create-database \
  --database-input '{"Name": "analytics"}' \
  --endpoint-url $AWS_ENDPOINT_URL

# Create a JSON table (standard AWS format for NDJSON data)
aws glue create-table \
  --database-name analytics \
  --table-input '{
    "Name": "orders",
    "StorageDescriptor": {
      "Location": "s3://my-bucket/orders/",
      "InputFormat": "org.apache.hadoop.mapred.TextInputFormat",
      "OutputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
      "SerdeInfo": {
        "SerializationLibrary": "org.openx.data.jsonserde.JsonSerDe"
      },
      "Columns": [
        {"Name": "id",     "Type": "int"},
        {"Name": "amount", "Type": "double"}
      ]
    }
  }' \
  --endpoint-url $AWS_ENDPOINT_URL

# Create a Parquet table
aws glue create-table \
  --database-name analytics \
  --table-input '{
    "Name": "events",
    "StorageDescriptor": {
      "Location": "s3://my-bucket/events/",
      "InputFormat": "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat",
      "SerdeInfo": {
        "SerializationLibrary": "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"
      },
      "Columns": [
        {"Name": "event_id", "Type": "string"},
        {"Name": "ts",       "Type": "bigint"}
      ]
    }
  }' \
  --endpoint-url $AWS_ENDPOINT_URL