-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.py
More file actions
25 lines (19 loc) · 838 Bytes
/
validation.py
File metadata and controls
25 lines (19 loc) · 838 Bytes
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
import pyodbc
def hive_con_validate():
con = pyodbc.connect('DSN=Hive_DSN', autocommit=True)
cur = con.cursor()
cur.execute('create database if not exists airline_dataset')
con.close()
def hive_connection():
con = pyodbc.connect('DSN=Hive_DSN', autocommit=True)
cur = con.cursor()
cur.execute('create database if not exists airline_dataset')
cur.execute('use airline_dataset')
return con, cur
def stage_tables_validate():
con,cur=hive_connection()
cur.execute('select count(*) from table airports_dim_stage_table limit 3')
cur.execute('select count(*) from table carriers_dim_stage_table limit 3')
cur.execute('select count(*) from table plane_dim_stage_table limit 3')
cur.execute("select count(*) from table data_fact_stage_table where year='2008' limit 3;")
con.close()