Skip to content

Instantly share code, notes, and snippets.

@adidonato
Created July 30, 2019 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adidonato/ce99868390d8de3c615d8a0830191493 to your computer and use it in GitHub Desktop.
Save adidonato/ce99868390d8de3c615d8a0830191493 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "Usage: ./show_last_updated_hive_table.sh #tablename"
time_column=`hive -e "show create table $1" | egrep "transient_lastDdlTime"`
time_value=`echo $time_column | sed 's/[|,)]//g' | awk -F '=' '{print $2}' | sed "s/'//g"`
tran_date=`date -d @$time_value +'%Y-%m-%d %H:%M:%S'`
echo $tran_date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment