Sling
Slingdata.ioBlogGithubHelp!
  • Introduction
  • Sling CLI
    • Installation
    • Environment
    • Running Sling
    • Global Variables
    • CLI Pro
  • Sling Platform
    • Sling Platform
      • Architecture
      • Agents
      • Connections
      • Editor
      • API
      • Deploy from CLI
  • Concepts
    • Replications
      • Structure
      • Modes
      • Source Options
      • Target Options
      • Columns
      • Transforms
      • Runtime Variables
      • Tags & Wildcards
    • Hooks / Steps
      • Check
      • Command
      • Copy
      • Delete
      • Group
      • Http
      • Inspect
      • List
      • Log
      • Query
      • Replication
      • Store
    • Pipelines
    • Data Quality
      • Constraints
  • Examples
    • File to Database
      • Custom SQL
      • Incremental
    • Database to Database
      • Custom SQL
      • Incremental
      • Backfill
    • Database to File
      • Incremental
  • Connections
    • Database Connections
      • BigTable
      • BigQuery
      • Cloudflare D1
      • Clickhouse
      • DuckDB
      • MotherDuck
      • MariaDB
      • MongoDB
      • Elasticsearch
      • MySQL
      • Oracle
      • Postgres
      • Prometheus
      • Proton
      • Redshift
      • StarRocks
      • SQLite
      • SQL Server
      • Snowflake
      • Trino
    • Storage Connections
      • AWS S3
      • Azure Storage
      • Backblaze B2
      • Cloudflare R2
      • DigitalOcean Spaces
      • FTP
      • Google Storage
      • Local Storage
      • Min.IO
      • SFTP
      • Wasabi
Powered by GitBook
On this page
  • Setup
  • Using sling conns
  • Environment Variable
  • Sling Env File YAML
  • Specifying a DuckDB version
  • Specifying a DuckDB Binary Path & Extensions
  • Potential Issue
  1. Connections
  2. Database Connections

DuckDB

Connect & Ingest data from / to a DuckDB database

Setup

The following credentials keys are accepted:

  • instance (required) -> The local file path of the database file

  • schema (optional) -> The default schema to use.

  • duckdb_version (optional) -> The CLI version of DuckDB to use. You can also specify the env. variable DUCKDB_VERSION.

  • read_only (optional) -> Whether to open the connection in readonly mode. Accepts true or false. Default is false.

  • interactive (optional) -> Whether to communicate to the DuckDB CLI via interactive mode instead of reopening the connection each time. Accepts true or false. Default is false.

Using sling conns

Here are examples of setting a connection named DUCKDB. We must provide the type=duckdb property:

# for local files 
$ sling conns set DUCKDB type=duckdb instance=/path/to/file.db

# for local files (Windows), don't use backslash (\)
$ sling conns set DUCKDB type=duckdb instance=C:/path/to/file.db

# Or use url (only for local files)
$ sling conns set DUCKDB url="duckdb:///path/to/file.db"

# url for Windows, don't use backslash (\)
$ sling conns set DUCKDB url="duckdb://C:/path/to/file.db"

Environment Variable

export DUCKDB='duckdb:///path/to/file.db'
export DUCKDB='{ type: duckdb, instance: "/path/to/file.db" }'

$env:DUCKDB="duckdb://C:/path/to/file.db" # for Windows PowerShell

Sling Env File YAML

connections:
  DUCKDB:
    type: duckdb
    instance: <instance>
    schema: <schema>
    duckdb_version: '<duckdb_version>'

Specifying a DuckDB version

By default, Sling will download the DuckDB binary automatically. If you would like to use a specific DuckDB version, you can specify this way, and sling will download that version:

export DUCKDB_VERSION='0.7.0'

Specifying a DuckDB Binary Path & Extensions

If you already have DuckDB on your machine and would like to use it (instead of having Sling download it), you can specify the binary path this way:

export DUCKDB_PATH='/opt/homebrew/bin/duckdb'
export DUCKDB_USE_INSTALLED_EXTENSIONS='true'  # tells sling not to download extensions

Potential Issue

If you have a .duckdbrc file, which runs commands whenever the DuckDB CLI is invoked, this may interfere with normal Sling operation. If you are facing weird issues and have this file, try again after deleting it.

PreviousClickhouseNextMotherDuck

Last updated 5 days ago

See to learn more about the sling env.yaml file.

If you are facing issues connecting, please reach out to us at , on or open a Github Issue .

support@slingdata.io
discord
here
here