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
  • Getting Started
  • Installation
  • Setting up your Connections
  • Using Sling
  • With Python
  1. Sling CLI

Installation

An introduction to using the Sling CLI tool.

PreviousIntroductionNextEnvironment

Last updated 19 days ago

Getting Started

sling CLI is a free tool that allows data extraction and loading from / into many popular databases / storage platforms. Follow the instructions below to install it on your respective operating system.

Installation

Brew on Mac

# Install with brew first
brew install slingdata-io/sling/sling

# Once, installed, `sling` should be available
sling -h

Scoop on Windows

scoop bucket add sling https://github.com/slingdata-io/scoop-sling.git
scoop install sling

# You're good to go!
sling -h

Linux

# download latest binary
curl -LO 'https://github.com/slingdata-io/sling-cli/releases/latest/download/sling_linux_amd64.tar.gz' \
  && tar xf sling_linux_amd64.tar.gz \
  && rm -f sling_linux_amd64.tar.gz \
  && chmod +x sling

# You're good to go!
./sling -h

Docker

docker pull slingdata/sling

docker run --rm -i slingdata/sling --help

Other Binary Downloads

Setting up your Connections

Sling looks for credentials in several places:

  • Environment Variables

  • Sling Env File (located at ~/.sling/env.yaml)

  • DBT Profiles Files (located at ~/.dbt/profiles.yml)

Using Sling

sling CLI is designed to be easy to use. Say we want to load a CSV file into a PostgreSQL database. We could run the following command:

export MY_PG='postgresql://user:mypassw@pg.host:5432/db1'

sling run --src-stream file:///path/to/myfile.csv --tgt-conn MY_PG --tgt-object public.my_new_data

# OR pipe it in
cat /path/to/myfile.csv | sling run --tgt-conn MY_PG --tgt-object public.my_new_data
export MY_PG='postgresql://user:mypassw@pg.host:5432/db1'

sling run --src-stream file:///path/to/myfile.csv --tgt-conn MY_PG --tgt-object public.my_new_data

# OR pipe it in
cat /path/to/myfile.csv | sling run --tgt-conn MY_PG --tgt-object public.my_new_data
# using windows Powershell
$env:MY_PG = 'postgresql://user:mypassw@pg.host:5432/db1'
sling run --src-stream file://C:/path/to/myfile.csv --tgt-conn MY_PG --tgt-object public.my_new_data

# OR pipe it in
cat C:\path\to\myfile.csv | sling run --tgt-conn MY_PG --tgt-object public.my_new_data
export MY_PG='postgresql://user:mypassw@pg.host:5432/db1'

docker run --rm -i -e MY_PG -v /path/to/myfile.csv slingdata/sling run --src-stream file:///path/to/myfile.csv --tgt-conn MY_PG --tgt-object public.my_new_data

With Python

If you have Python pip installed, you can simply run:

pip install sling
from sling import Replication, ReplicationStream

replication = Replication(
  source='MY_PG',
  target='MY_AWS_S3',
  steams={
    "my_table": ReplicationStream(
      sql="select * from my_table",
      object='my_folder/new_file.csv',
    ),
  }
)

replication.run()

Follow these to install HomeBrew for mac if not already installed.

See on Github.

Please see for more details.

You call also check out the library on github.

directions
Releases
environment
Python wrapper
Sling CLI Demo