1 year ago
#73494
KMittal
Create a hive table using python
I am using python and I want to create a hive table. Also I want that table should be created with same data type as of data type in dataframe;
Below is the code I used to create a connection with hive :
import pandas as pd
pd.options.display.float_format = '{:.2f}'.format
import pyodbc
import pandas as pd
conn_hive_core = pyodbc.connect(DSN="IMPALA64" ,Schema="db1",autocommit=True)
sql_1= """ set queue"""
cnxn = pyodbc.connect(DSN="IMPALA64", Schema="db1",autocommit=True)
cursor = cnxn.cursor()
cursor.execute(sql_1)
sql_2 = """select * from db1.table1"""
a = pd.read_sql_query(sql_2, cnxn)
a
Above code is working. using below dataframe i want to create a hive table :
df = pd.read_csv("data.csv")
python
hive
pyodbc
impala
0 Answers
Your Answer