Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bonddim/go-sqlcmd

go-sqlcmd cli for Microsoft SQL Server, Azure SQL and Azure Synapse
https://github.com/bonddim/go-sqlcmd

azure-sql go-sqlcmd mssql sql-server sqlcmd

Last synced: about 2 months ago
JSON representation

go-sqlcmd cli for Microsoft SQL Server, Azure SQL and Azure Synapse

Awesome Lists containing this project

README

        

# [go-sqlcmd](https://github.com/microsoft/go-sqlcmd) docker image

[docker-hub]: https://hub.docker.com/r/bonddim/go-sqlcmd
[![Docker](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml/badge.svg)](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml)
[![Docker Image Version](https://img.shields.io/docker/v/bonddim/go-sqlcmd?logo=docker&label=latest)][docker-hub]
[![Docker Image Size](https://img.shields.io/docker/image-size/bonddim/go-sqlcmd?logo=docker)][docker-hub]
[![Docker Pulls](https://img.shields.io/docker/pulls/bonddim/go-sqlcmd?logo=docker&label=pulls)][docker-hub]
[![GitHub License](https://img.shields.io/github/license/bonddim/go-sqlcmd)](https://github.com/bonddim/go-sqlcmd?tab=MIT-1-ov-file)

## About

- Supported architectures: **amd64**, **arm64**, **s390x**
- Uses [gcr.io/distroless/static:nonroot](https://github.com/GoogleContainerTools/distroless) as image base
- Uses [released sqlcmd](https://github.com/microsoft/go-sqlcmd/releases) binary
- Updated automatically by Renovate

## Usage

```bash
# Pull image from Docker Hub
docker pull bonddim/go-sqlcmd
# Or GitHub Container Registry
docker pull ghcr.io/bonddim/go-sqlcmd
```

Docker container with mounted scripts to run:

```bash
docker run \
--rm \
-v $(pwd)/sql_scripts:/mnt/sql \
-e SQLCMDPASSWORD={{ password }} \
ghcr.io/bonddim/go-sqlcmd \
-i /mnt/sql \
-S {{ server }} \
-d {{ database }} \
-u {{ user }}
```

K8s pod with Entra ID authentication:

```yaml
apiVersion: v1
kind: Pod
metadata:
name: go-sqlcmd
labels:
azure.workload.identity/use: "true"
spec:
serviceAccountName: go-sqlcmd
containers:
- name: go-sqlcmd
image: bonddim/go-sqlcmd
args:
- --use-aad
- --server
- {{ server }}.database.windows.net
- --database-name
- {{ database }}
- --query
- {{ query }}
securityContext:
runAsNonRoot: true
...
```

Refer to official [docs](https://docs.microsoft.com/sql/tools/go-sqlcmd-utility) for syntax and command line arguments

## License

Inherited from [microsoft/go-sqlcmd](https://github.com/microsoft/go-sqlcmd?tab=MIT-1-ov-file)