dbcli / dbcli/mssql-cli

Able to pipe query into stdin and get csv on stdout

Abierto
#105 14 comentarios 16 reacciones 1 asignado Reclamado por @ellbosch Ver en GitHub
area: non-interactive enhancement
Lenguaje dominante
Python
Estrellas
1.4k
Forks
191
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

We use commandline tools to transfer data from postgresql, mysql and sqlserver to (in our case) a postgresql server.

The basic idea is like this (in this case we get data from mysql and import it in postgresql:

```
# schema.table was created to have the same layout as whatever is getting out of the csv
echo "SELECT ... FROM ...; " | /bin/bash -o pipefail -c "\
MYSQL_PWD=password mysql --user=projecta --host=x.x.x.x --port=xxxx --skip-column-names | \
PGOPTIONS='--client-min-messages=warning' PGTZ=Europe/Berlin \
psql --username=xxx --host=hostname --no-psqlrc --set ON_ERROR_STOP=on database --echo-queries \
--command=\"COPY schema.table FROM STDIN WITH NULL AS 'NULL'\"";
```
[we also run all our ETL via sending queries to stdin of a psql call, but to support that in mssql-cli would also mean "import csv on stdin" support to actually get the data into sql server]

For sqlserver, we currently use sqsh but supports at least the "SQL Script in, csv out" workflow. As sqsh is unmaintained (and buggy in versions available in ubuntu/debian), we would like to replace this by whatever finally supports at least exporting csv on stdout.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.