Created
January 19, 2022 07:31
-
-
Save velotiotech/5b0f65bd43389625bbf97345725c2514 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
from pyspark.sql import SparkSession | |
## creating sparkSession to get entrypoint to spark application | |
sparkSession = SparkSession\ | |
.builder\ | |
.appName('Write_table_to_hive')\ | |
.enableHiveSupport()\ | |
.getOrCreate() | |
## reading data from dataset "Video_Games_5.json" | |
GamesReviewDataFrame = sparkSession.read.format("json") \ | |
.format("json") \ | |
.option("path", "/home/velotio/Downloads/UnstructuredData/Video_Games_5.json")\ | |
.load() | |
## we can modify data the way we want to represent in table here | |
GamesReviewDataFrame.show() | |
## writing dataframe "GamesReviewDataFrame" as a table in HIVE. | |
GamesReviewDataFrame.write.saveAsTable("GameReviewTable") | |
sparkSession.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment