Skip to content

Commit 3b47465

Browse files
committed
Init push
0 parents  commit 3b47465

27 files changed

+1729
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
.git
3+
src/__pycache__
4+
output/*
5+
resource/.gitkeep

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__pycache__
2+
.mypy_cache
3+
.venv
4+
postgres-diagrams.egg-info
5+
src/postgres-diagrams.egg-info

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.10-slim
2+
3+
ARG USERNAME=postgres-diagrams
4+
ARG GROUPNAME=postgres-diagrams
5+
ARG UID=1000
6+
ARG GID=1000
7+
ARG APP_DIR=/usr/local/postgres-diagrams
8+
9+
RUN groupadd -g "$GID" "$GROUPNAME" \
10+
&& useradd -m -s /bin/bash -u "$UID" -g"$GID" "$USERNAME" \
11+
&& apt-get update && apt-get install -y --no-install-recommends graphviz \
12+
&& apt-get clean \
13+
&& rm -rf /var/lib/apt/lists/* \
14+
&& mkdir -p "$APP_DIR"
15+
16+
COPY ./setup.cfg "$APP_DIR"
17+
COPY ./setup.py "$APP_DIR"
18+
COPY ./src "$APP_DIR"
19+
20+
RUN cd "$APP_DIR" && pip install -e .
21+
22+
USER "$USERNAME"
23+
WORKDIR "$APP_DIR"

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '1.0'
2+
services:
3+
postgres-diagrams:
4+
container_name: postgres-diagrams
5+
image: postgres-diagrams
6+
restart: always
7+
build: .
8+
tty: true
9+
volumes:
10+
- ./src:/usr/local/postgres-diagrams/src
11+
- ./resource:/usr/local/postgres-diagrams/resource
12+
- ./output:/usr/local/postgres-diagrams/output
13+
- ./tests:/usr/local/postgres-diagrams/tests

output/.gitkeep

Whitespace-only changes.

output/result.clv.png

7.61 KB
Loading

output/result.tlv.png

18.8 KB
Loading

requirements.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
click==8.1.3
2+
graphviz==0.20.1
3+
mccabe==0.7.0
4+
packaging==23.0
5+
pathspec==0.11.0
6+
pglast==5.1
7+
platformdirs==3.0.0
8+
tomli==2.0.1
9+
tqdm==4.65.0
10+
typing_extensions==4.5.0

resource/ps1.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
INSERT INTO table4 (col1, col2)
2+
SELECT col1, 'c2' FROM table1;

resource/ps2.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UPDATE table4 SET col2 = table2.col2
2+
FROM table2, table3
3+
WHERE table4.col2 = table3.col1;

resource/ps3.sql

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DELETE FROM table4
2+
WHERE EXISTS
3+
(
4+
SELECT 1
5+
FROM table3
6+
WHERE table3.col2 = table4.col2
7+
);

resource/ps4.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT col1, col2
2+
FROM table4;

setup.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[metadata]
2+
name = postgres-diagrams
3+
4+
[options]
5+
install_requires =
6+
graphviz
7+
pglast
8+
tqdm
9+
chardet
10+
11+
[options.extras_require]
12+
test =
13+
pytest

setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from setuptools import setup
2+
3+
setup()

0 commit comments

Comments
 (0)