Created
October 2, 2020 02:33
-
-
Save welly87/835eb53fe7f48b0bae5f6e3db0441500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
? |
Author
welly87
commented
Oct 2, 2020
%cd squdu/
!chmod +x ./ingest.sh
!./ingest.sh
:q
from impala.dbapi import connect
from impala.util import as_pandas
import sys
import os
conn = connect(host='178.128.112.105', port=21050)
cursor = conn.cursor()
kudu_table_name = os.environ['KUDU_TABLE_NAME']
impala_table_name = os.environ['IMPALA_TABLE_NAME']
create_statment = 'CREATE EXTERNAL TABLE IF NOT EXISTS ' + impala_table_name + ' STORED AS KUDU TBLPROPERTIES("kudu.table_name" = "' + kudu_table_name + '");'
cursor.execute(create_statment)
print("table created")
cursor.execute('SELECT count(*) FROM ' + impala_table_name)
df = as_pandas(cursor)
print(df.head())
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment