# SQ - swiss-army knife for data

> Clean Markdown view of GeekNews topic #3841. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=3841](https://news.hada.io/topic?id=3841)
- GeekNews Markdown: [https://news.hada.io/topic/3841.md](https://news.hada.io/topic/3841.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-03-06T09:12:08+09:00
- Updated: 2021-03-06T09:12:08+09:00
- Original source: [sq.io](https://sq.io/)
- Points: 9
- Comments: 1

## Topic Body

- jq for relational data

- 커맨드 라인에서 다양한 데이터를 inspect,query,join,import/export 가능

ㅤ→ MySQL,SQL Server,Postgres,SQLite,XLS,CSV,XML,JSON

- 다른 커맨드라인 도구와 piping 가능

- jq 방식의 쿼리언어인 SLQ 또는 SQL 사용 가능

[ SQL Server 의 테이블을 SQLite로 복사 ]

$ sq add "sqlserver://sakila:$PASSWD@192.168.50.130?database=sakila"

$ sq add ./sakila.db --handle @sakila_sl3

$ sq sql --src=@sakila_mssql "SELECT * FROM actor WHERE first_name = 'PENELOPE'" --insert @sakila_sl3.actor_copy

[ 전체 DB 테이블을 각각의 CSV파일로 Export ]

$ sq inspect -j | jq -r '.tables[] | .name' | xargs -I % sq .% --csv --output %.csv

## Comments



### Comment 4604

- Author: sagehoit
- Created: 2021-03-08T13:24:28+09:00
- Points: 1

DB 전환이나 백업용으로도 활용할 수 있겠네요~!
