Skip to content

Commit 72c3d7b

Browse files
committed
pylint
1 parent b12dde6 commit 72c3d7b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

etl/data.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#%%
22
print("PYHTON LOG: Importing Libraries")
33

4-
import warnings
5-
warnings.filterwarnings("ignore")
4+
"""
5+
This module handles the ETL processes using PySpark and SQLAlchemy.
6+
"""
67

78
import os
8-
9+
import warnings
910
from pyspark.sql import SparkSession
1011
import pyspark.pandas as ps
1112
from sqlalchemy import create_engine
1213
from dotenv import load_dotenv
1314

15+
warnings.filterwarnings("ignore")
16+
1417
load_dotenv()
1518

1619
print("PYTHON LOG: Imported libraries successfully")
@@ -21,15 +24,15 @@
2124
USER=os.getenv('USER')
2225
PASSWORD=os.getenv('PASSWORD')
2326

24-
jdbc_url="jdbc:postgresql://{}/{}".format(HOST,DATABASE)
25-
jdbc_driver_path = "C:/spark/jars/postgresql-42.7.3.jar"
27+
jdbc_url=f"jdbc:postgresql://{HOST}/{DATABASE}"
28+
JDBC_DRIVER_PATH = "C:/spark/jars/postgresql-42.7.3.jar"
2629

2730
print('PYTHON LOG: Creating Spark Session')
2831
# Initialize Spark session
2932
spark = SparkSession \
3033
.builder \
31-
.config("sparkk.jars", jdbc_driver_path) \
32-
.config('spark.driver.extraClassPath', jdbc_driver_path) \
34+
.config("sparkk.jars", JDBC_DRIVER_PATH) \
35+
.config('spark.driver.extraClassPath', JDBC_DRIVER_PATH) \
3336
.appName("Data ETL") \
3437
.getOrCreate()
3538
print('PYTHON LOG: Created Spark Session Successfully')
@@ -56,10 +59,9 @@
5659
.option('dbtable', 'stage_loan') \
5760
.option("driver", "org.postgresql.Driver") \
5861
.save()
59-
6062
print('PYTHON LOG: Saved to database successfully')
6163
#%%
6264
print("PYTHON LOG: Stopping Spark Session")
6365
spark.stop()
6466
print("PYTHON LOG: Spark Session stopped successfully")
65-
#%%
67+
#%%

0 commit comments

Comments
 (0)