Created
March 6, 2021 20:03
-
-
Save itayB/49a1b4121b512cb33733e41371e36d3a 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "removed-perth", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from ipynb.fs.full.spark_application import get_spark_session\n", | |
"\n", | |
"spark = get_spark_session(\"aws_localstack\", swan_spark_conf)\n", | |
"try:\n", | |
" df = spark.read.csv('s3a://my-bucket/stocks.csv',header=True)\n", | |
" df.printSchema()\n", | |
" print(df.count())\n", | |
"except Exception as exp:\n", | |
" print(exp)\n", | |
" \n", | |
"spark.stop()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment