I am writing this code to get the integer value of count in specified table:
sc = SparkContext("local", "spar")
hive_context = HiveContext(sc)
hive_context.sql("use zs_trainings_trainings_db")
df = hive_context.sql("select count(*) from ldg_sales")
Either:
hive_context.table("sales").count
or
hive_context.sql("select count(*) from ldg_sales").first()[0]