-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pg-dd): add subcommands for loading, dumping, uploading and down…
…loading
- Loading branch information
Showing
12 changed files
with
281 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ deploy | |
.env | ||
.env.example | ||
.gitignore | ||
Makefile | ||
README.md | ||
data | ||
.ruff_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.env | ||
data | ||
.ruff_cache | ||
.ruff_cache | ||
response.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This Dockerfile is intended to be used as part of a Docker Compose setup. | ||
# When running this microservice from the Docker Compose root, this Dockerfile | ||
# will build the image, install dependencies, and start the server | ||
|
||
FROM public.ecr.aws/docker/library/python:3.12 | ||
|
||
ARG POETRY_VERSION=1.8 | ||
RUN pip install "poetry==${POETRY_VERSION}" | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN poetry install --no-root | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "make", "local"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from pg_dd.pg_dd import PgDDLocal, PgDDS3 | ||
import click | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
|
||
@cli.command() | ||
def download(): | ||
""" | ||
Download S3 CSV dumps to the local directory. | ||
""" | ||
PgDDS3().download_local() | ||
|
||
|
||
@cli.command() | ||
def upload(): | ||
""" | ||
Uploads local CSV dumps to S3. | ||
""" | ||
PgDDS3().write_to_bucket() | ||
|
||
|
||
@cli.command() | ||
def dump(): | ||
""" | ||
Dump from the local database to CSV files. | ||
""" | ||
PgDDLocal().write_to_dir() | ||
|
||
|
||
@cli.command() | ||
def load(): | ||
""" | ||
Load local CSV files into the database | ||
""" | ||
PgDDLocal().load_to_database() | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.