SQL development tools for various scenarios
391
A Docker image containing a suite of SQL development tools for working with various databases. This image includes tools for SQL linting, formatting, schema migration, and code generation, along with database clients for MySQL and PostgreSQL.
This Docker image is built on ubuntu:25.04 and provides a development environment with the following tools:
Pull the Image (if published to a registry, e.g., Docker Hub):
docker pull danibron/sql-dev-tools:latest
Or Build the Image Locally: Clone the repository and build the Docker image:
git clone https://github.com/DaniBr/sql-dev-tools.git
cd sql-dev-tools
docker build -t sql-dev-tools .
Start the container with the default command,
which is reflex -s -g reflex.conf -- reflex -c reflex.conf (see here):
docker run -it -v $(pwd)/sql:/sql sql-dev-tools:latest
-v $(pwd)/sql:/sql: Mounts a local sql directory to /sql in the container for your SQL files and reflex.conf configuration.The tool uses a reflex.conf file for its configuration.
Any changes made to reflex.conf are hot reloaded, so you do not need to restart the tool when updating it.
Example reflex.conf:
-r 'schema\.sql$' --start-service -- task update_schema
The container automatically runs a pre-reflex task before starting the reflex file watcher. This allows you to perform setup operations like code generation, schema setup, or validation before development begins.
Example Taskfile.yml with pre-reflex:
version: '3'
tasks:
pre-reflex:
desc: "Setup tasks before starting file watching"
cmds:
- sqlc generate
- sqlfluff lint --fail-if-violations ./src/**/*.sql
- echo "Pre-reflex setup complete - starting file watcher"
# Other tasks can be defined afterwards
If the pre-reflex task doesn't exist, the container will continue without error and start reflex normally.
Lint SQL Files with SQLFluff:
docker run -v $(pwd)/sql:/sql sql-dev-tools:latest sqlfluff lint /sql/queries.sql
Manage Schema Migrations with atlas:
docker run -v $(pwd)/sql:/sql sql-dev-tools:latest atlas schema apply --url "mysql://user:pass@host:3306/database_name" --file /sql/schema.sql
Generate Go Code with sqlc:
docker run -v $(pwd)/sql:/sql sql-dev-tools:latest sqlc generate
Update procedures, functions, triggers with database client:
psql -d $DATABASE_URL -f my-functions.sql
mysql $DATABASE_NAME --user=$DATABASE_USER < my-functions.sql
Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.
git checkout -b feature/your-feature).git commit -m 'Add your feature').git push origin feature/your-feature).This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, please open an issue on the GitHub repository or contact the maintainer.
Content type
Image
Digest
sha256:0e85a8ae8…
Size
195.6 MB
Last updated
about 1 year ago
docker pull danibron/sql-dev-tools