-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (37 loc) · 1.29 KB
/
Copy pathmain.py
File metadata and controls
50 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Entry point for the E-commerce Analytics ETL Pipeline.
Initializes all pipeline components - extractors, transformer,
and loader - then executes the full ETL workflow.
"""
import logging
from pipeline.utils import setup_logging, DBConnectionManager
from pipeline.extractors import FileExtractor, DbExtractor
from pipeline.transformers import SalesTransformer
from pipeline.loaders import FileLoader
from pipeline.main_pipeline import ETLPipeline
# Configure logging before any pipeline logic runs.
setup_logging()
logger = logging.getLogger(__name__)
def main():
"""
Assembles and runs the ETL pipeline.
Creates concrete implementations for each pipeline stage
and injects them into the orchestrator via constructor (DI).
"""
# -- Database connection manager (shared across DB extractors) --
db_manager = DBConnectionManager()
# -- Build pipeline components --
file_extractor = FileExtractor()
db_extractor = DbExtractor(db_manager=db_manager)
transformer = SalesTransformer()
loader = FileLoader()
# -- Assemble and run the pipeline --
pipeline = ETLPipeline(
file_extractor=file_extractor,
db_extractor=db_extractor,
transformer=transformer,
loader=loader
)
pipeline.run()
if __name__ == '__main__':
main()