Данные не загружаются в Greenplum с помощью Pandas
Я пытаюсь загрузить данные из Greenplum в Greenplum с помощью Pandas, но данные не отражаются в целевой таблице. Тот же код может сохранять данные в CSV, и я могу загрузить данные из CSV в целевую таблицу, но не напрямую из Greenplum в Greenplum. Пожалуйста, предложите.
import pandas as pd
import numpy as np
import time, os, fnmatch, shutil
from scipy.stats import chi2
from sqlalchemy import create_engine
engine = create_engine('postgresql://user@localhost:5432/mydb')
df_gpdb = pd.read_sql_query(" Select Columns from Table limit 1 ",con=engine)
inc_count_lvl_1 = df_gpdb['level1']
exam_count=df_gpdb['ecount']
ipte1 = []
for count_loop in range(len(exam_count)):
if exam_count[count_loop] < 1:
ipte1.append(-9999)
else:
if inc_count_lvl_1[count_loop] > 5:
ipte1_temp1 = (inc_count_lvl_1[count_loop]/exam_count[count_loop])*1000
ipte1.append(ipte1_temp1)
else:
dof = 2*(inc_count_lvl_1[count_loop]+ 1)
chisquare1=chi2.ppf(0.5,dof)
ipte1_temp2=(chisquare1/(2*exam_count[count_loop]))
ipte1.append(ipte1_temp2)
se_gpdb = pd.Series(ipte1)
df_gpdb['ipte1'] = se_gpdb.values
df_gpdb.to_csv(r"/localpath/output.csv") # this is loading correct data into csv
df_gpdb.to_sql('tableName',engine,index=False,if_exists='replace') #this is not loading any data into target and no error on console.