postgresql data accelerator.md

For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs; this page is available as Markdown.

PostgreSQL Data Accelerator

To use PostgreSQL as Data Accelerator, specify postgres as the engine for acceleration.

datasets:
  - from: spice.ai:path.to.my_dataset
    name: my_dataset
    acceleration:
      engine: postgres

Configuration

The connection to PostgreSQL can be configured by providing the following params:

Configuration params are provided either in the acceleration section of a dataset.

datasets:
  - from: spice.ai:path.to.my_dataset
    name: my_dataset
    acceleration:
      engine: postgres
      params:
        pg_host: my_db_host
        pg_port: 5432
        pg_db: my_database
        pg_user: my_user
        pg_pass: ${secrets:my_pg_pass}
        pg_sslmode: require

Arrow to PostgreSQL Type Mapping

The table below lists the supported Apache Arrow data types and their mappings to PostgreSQL types when stored

Arrow Type sea_query ColumnType PostgreSQL Type
Int8 TinyInteger smallint
Int16 SmallInteger smallint
Int32 Integer integer
Int64 BigInteger bigint
UInt8 TinyUnsigned smallint
UInt16 SmallUnsigned smallint
UInt32 Unsigned bigint
UInt64 BigUnsigned numeric
Decimal128 / Decimal256 Decimal decimal
Float32 Float real
Float64 Double double precision
Utf8 / LargeUtf8 Text text
Boolean Boolean bool
Binary / LargeBinary VarBinary bytea
FixedSizeBinary Binary bytea
Timestamp (no Timezone) Timestamp timestamp without time zone
Timestamp (with Timezone) TimestampWithTimeZone timestamp with time zone
Date32 / Date64 Date date
Time32 / Time64 Time time
Interval Interval interval
Duration BigInteger bigint
List / LargeList / FixedSizeList Array array
Struct N/A Composite (Custom type)

LIMITATIONS