Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit 6b16f43

Browse files
authored
Merge pull request #17 from PageUpPeopleOrg/mcd-module-test
Change MCD to proper module structure
2 parents 78a8066 + 81e63fc commit 6b16f43

20 files changed

+45
-46
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A utility that persists state of a data pipeline execution and uses them to dete
77
## Usage
88

99
```
10-
$ python mcd.py [options] {db-connection-string} <command> [command-parameters]
10+
$ python -m mcd [options] {db-connection-string} <command> [command-parameters]
1111
```
1212

1313
- `options` include:
@@ -34,8 +34,8 @@ $ python mcd.py [options] {db-connection-string} <command> [command-parameters]
3434
To get help, use:
3535

3636
```
37-
$ python mcd.py --help
38-
$ python mcd.py <command> --help
37+
$ python -m mcd --help
38+
$ python -m mcd <command> --help
3939
```
4040

4141
### Usage Example
@@ -44,18 +44,18 @@ $ python mcd.py <command> --help
4444
$ pipenv install
4545
$ pipenv shell
4646
47-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname init-execution
47+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname init-execution
4848
49-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname get-last-successful-execution
50-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname get-execution-last-updated-timestamp id-as-returned-by-get-last-successful-execution-command
49+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname get-last-successful-execution
50+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname get-execution-last-updated-timestamp id-as-returned-by-get-last-successful-execution-command
5151
52-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command load ./relative/path/to/load/models **/*.json
53-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command load
52+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command load ./relative/path/to/load/models **/*.json
53+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command load
5454
55-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command transform C:/absolute/path/to/transform/models group1/*.csv ./group2/**/*.sql
56-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command transform
55+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command transform C:/absolute/path/to/transform/models group1/*.csv ./group2/**/*.sql
56+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command transform
5757
58-
$ python mcd.py postgresql+psycopg2://user:password@host:port/dbname complete-execution id-as-retured-by-init-command
58+
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname complete-execution id-as-retured-by-init-command
5959
```
6060

6161
## Prerequisites

mcd.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
File renamed without changes.

modules/DataRepository.py renamed to mcd/DataRepository.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from sqlalchemy import desc, select
22
from sqlalchemy.sql import func
33
from sqlalchemy.orm import sessionmaker
4-
from modules import Shared
5-
from modules.BaseObject import BaseObject
6-
from modules.Shared import Constants
7-
from modules.entities.DataPipelineExecutionEntity import DataPipelineExecutionEntity
8-
from modules.entities.ModelChecksumEntity import ModelChecksumEntity
4+
from mcd import Shared
5+
from mcd.BaseObject import BaseObject
6+
from mcd.Shared import Constants
7+
from mcd.entities.DataPipelineExecutionEntity import DataPipelineExecutionEntity
8+
from mcd.entities.ModelChecksumEntity import ModelChecksumEntity
99

1010

1111
class DataRepository(BaseObject):

modules/ModelChangeDetector.py renamed to mcd/ModelChangeDetector.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import argparse
22
import logging
33

4-
from modules import Shared
5-
from modules.BaseObject import BaseObject
6-
from modules.Shared import Constants
7-
from modules.commands.InitialiseExecutionCommand import InitialiseExecutionCommand
8-
from modules.commands.GetLastSuccessfulExecutionCommand import GetLastSuccessfulExecutionCommand
9-
from modules.commands.GetExecutionLastUpdateTimestampCommand import GetExecutionLastUpdateTimestampCommand
10-
from modules.commands.PersistModelsCommand import PersistModelsCommand
11-
from modules.commands.CompareModelsCommand import CompareModelsCommand
12-
from modules.commands.CompleteExecutionCommand import CompleteExecutionCommand
4+
from mcd import Shared
5+
from mcd.BaseObject import BaseObject
6+
from mcd.Shared import Constants
7+
from mcd.commands.InitialiseExecutionCommand import InitialiseExecutionCommand
8+
from mcd.commands.GetLastSuccessfulExecutionCommand import GetLastSuccessfulExecutionCommand
9+
from mcd.commands.GetExecutionLastUpdateTimestampCommand import GetExecutionLastUpdateTimestampCommand
10+
from mcd.commands.PersistModelsCommand import PersistModelsCommand
11+
from mcd.commands.CompareModelsCommand import CompareModelsCommand
12+
from mcd.commands.CompleteExecutionCommand import CompleteExecutionCommand
1313

1414

1515
class ModelChangeDetector(BaseObject):
File renamed without changes.

mcd/__init__.py

Whitespace-only changes.

mcd/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from mcd.ModelChangeDetector import ModelChangeDetector
2+
3+
ModelChangeDetector()

modules/commands/BaseCommand.py renamed to mcd/commands/BaseCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sqlalchemy import create_engine
2-
from modules.DataRepository import DataRepository
3-
from modules.BaseObject import BaseObject
2+
from mcd.DataRepository import DataRepository
3+
from mcd.BaseObject import BaseObject
44

55

66
class BaseCommand(BaseObject):

modules/commands/CompareModelsCommand.py renamed to mcd/commands/CompareModelsCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from modules.commands.BaseCommand import BaseCommand
2-
from modules.Shared import Constants
1+
from mcd.commands.BaseCommand import BaseCommand
2+
from mcd.Shared import Constants
33

44

55
class CompareModelsCommand(BaseCommand):

0 commit comments

Comments
 (0)