Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add reference fields #13

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,18 @@ Import DMAP data into a PostgreSQL database
* run `docker-compose build` to build the docker images for local testing
* run `docker-compose up dmap_local_rds` to stand up a local postgres db
* this imnage could be used when running pytest
* run `docker-compose up dmap_importer` to run the importer application
* run `docker-compose up dmap_import` to run the importer application

### Outside of Docker

1. Navigate to repository directory.
2. Update `.env` variable. Source it `source .env`.
3. Run `poetry run start` to run the ingestion process.
4. Run `psql postgresql://postgres:[email protected]:5432/dmap_importer` to get into the database. Alternatively, after `docker-compose up`, you can:
1. `docker exec -it dmap_local_rds bash`
2. `psql -U postgres -d dmap_importer`
5. Run format, type and lint checker:
* `poetry run black .`
* `poetry run mypy .`
* `poetry run pylint src tests`
6. Run tests, `poetry run pytest`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""new reference org name columns

Revision ID: 0d3bf1348c58
Revises: d630193252db
Create Date: 2024-06-01 22:10:22.189820

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "0d3bf1348c58"
down_revision: Union[str, None] = "d630193252db"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column(
"use_transaction_longitudinal", sa.Column("reference", sa.String())
grejdi-mbta marked this conversation as resolved.
Show resolved Hide resolved
)
op.add_column(
"use_transaction_location", sa.Column("reference", sa.String())
)
op.add_column("sale_transaction", sa.Column("reference", sa.String()))


def downgrade() -> None:
op.drop_column("use_transaction_longitudinal", "reference")
op.drop_column("use_transaction_location", "reference")
op.drop_column("sale_transaction", "reference")
1 change: 1 addition & 0 deletions src/dmap_import/schemas/sale_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ class SaleTransaction(SqlBase):
discount_amount = sa.Column(sa.BigInteger, nullable=True)
_exported_dtm = sa.Column(sa.DateTime, nullable=True)
promotion_id = sa.Column(sa.String(), nullable=True)
reference = sa.Column(sa.String(), nullable=True)
1 change: 1 addition & 0 deletions src/dmap_import/schemas/use_transaction_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ class UseTransactionalLocation(SqlBase):
fare_rule_description = sa.Column(sa.String(), nullable=True)
_exported_dtm = sa.Column(sa.DateTime, nullable=True)
promotion_id = sa.Column(sa.String(), nullable=True)
reference = sa.Column(sa.String(), nullable=True)
1 change: 1 addition & 0 deletions src/dmap_import/schemas/use_transaction_longitudinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@ class UseTransactionalLongitudinal(SqlBase):
fare_rule_description = sa.Column(sa.String(), nullable=True)
_exported_dtm = sa.Column(sa.DateTime, nullable=True)
promotion_id = sa.Column(sa.String(), nullable=True)
reference = sa.Column(sa.String(), nullable=True)
Loading