- This is to demonstrate the various ways Sling CLI is able to load files from a File System into a Database
- Compatible file formats include: CSV, TSV, JSON and XML. Parquet to come soon.
- Compatible File Systems include: AWS S3, Google Cloud Storage, Azure Blob Storage, DigitalOcean Spaces, BackBlaze B2, Cloudflare R2, Wasabi
- Compatible database systems: MySQL, Clickhouse, BigTable, Postgres, Snowflake, BigQuery, Redshift, SQL Server, Oracle
- Check here for all connector list
          Last active
          December 13, 2022 11:03 
        
      - 
      
- 
        Save flarco/02ea01a1f0bf3f34889dbd3c7f78e30d to your computer and use it in GitHub Desktop. 
    Sling CLI Examples - Loading from a File System into a Database (https://docs.slingdata.io/sling-cli/)
  
        Objective:
- Goal is to ingest a single CSV file from our local drive into a Database
Assumptions:
- Sling CLI is installed (see here)
- CSV file exists at path /tmp/accounts.csv(orC:/Temp/accounts.csvfor Windows)
- Connections named SNOWFLAKEandPOSTGRESare setup for sling to read (see here)
With full-refresh mode:
# For Mac / Linux
sling run --src-stream file:///tmp/accounts.csv --tgt-conn SNOWFLAKE --tgt-object sling.accounts --mode full-refresh
# For Windows (Powershell)
sling run --src-stream file://C:/Temp/accounts.csv --tgt-conn SNOWFLAKE --tgt-object sling.accounts --mode full-refresh# For Mac / Linux
cat /tmp/accounts.csv | sling run --tgt-conn POSTGRES --tgt-object sling.accounts --mode full-refresh
# For Windows (Powershell)
cat C:/Temp/accounts.csv | sling run --tgt-conn POSTGRES --tgt-object sling.accounts --mode full-refreshObjective:
- Goal is to ingest a single JSON file from our local drive into a Database, with full-refreshmode.
Assumptions:
- Sling CLI is installed (see here)
- CSV file exists at path /tmp/records.json(orC:/Temp/records.jsonfor Windows)
- Connections named BIGQUERYandMYSQLare setup for sling to read (see here)
With full-refresh mode:
# For Mac / Linux
sling run --src-stream file:///tmp/records.json --tgt-conn BIGQUERY --tgt-object sling.records --mode full-refresh
# For Windows (Powershell)
sling run --src-stream file://C:/Temp/records.json --tgt-conn BIGQUERY --tgt-object sling.records --mode full-refresh# For Mac / Linux
cat /tmp/records.json | sling run --tgt-conn MYSQL --tgt-object sling.records --mode full-refresh
# For Windows (Powershell)
cat C:/Temp/records.json | sling run --tgt-conn MYSQL --tgt-object sling.records --mode full-refreshObjective:
- Goal is to ingest a single CSV file from our SFTP connection into a Database
Assumptions:
- Sling CLI is installed (see here)
- CSV file exists at path /tmp/accounts.csvin our SFTP connection
- Connections named MY_SFTPandPOSTGRESare setup for sling to read (see here)
- The host value for MY_SFTPis11.12.23.45(an IP). Could also be a hostname (site.com).
With full-refresh mode:
sling run --src-conn MY_SFTP --src-stream sftp://11.12.23.45:22/tmp/accounts.csv --tgt-conn SNOWFLAKE --tgt-object sling.accounts --mode full-refresh
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment