<jupyter_start><jupyter_text>---<jupyter_code>from pyspark.sql import SparkSession
connector_path = "/Users/zacks/Desktop/Data Science Projects/Disaster-Response-Pipelines/code/sqlite-jdbc-3.36.0.3.jar"

spark = SparkSession.builder \
    .master("local") \
    .appName("LeetCode") \
    .config("spark.jars", connector_path) \
    .getOrCreate()
sc = spark.sparkContext

sc.setLogLevel('ERROR')
# SQLite Driver
driver = "org.sqlite.JDBC"
db_path =  "/Users/zacks/Desktop/Data Science Projects/Disaster-Response-Pipelines/code/disaster_response.db"
url = f"jdbc:sqlite:{db_path}"
tb = "disaster_response"
df = spark.read.format("jdbc").options(
    driver=driver, 
    url=url, 
    dbtable=tb
).load()
df.show()<jupyter_output>+---+--------------------+--------------------+------+-------+-------+-----+-----------+------------+----------------+-----------------+--------+--------+-----------+-----+----+-------+--------+-----+--------------+--------+-----+---------+----------------------+---------+---------+-----------+-----+---------+-----+-----------+--------------------+---------------+------+-----+----+----------+----+-------------+-------------+
| id|             message|            original| genre|related|request|offer|aid_related|medical_help|medical_products|search_and_rescue|security|military|child_alone|water|food|shelter|clothing|money|missing_people|refugees|death|other_aid|infrastructure_related|transport|buildings|electricity|tools|hospitals|shops|aid_centers|other_infrastructure|weather_related|floods|storm|fire|earthquake|cold|other_weather|direct_report|
+---+--------------------+--------------------+------+-------+-------+-----+-----------+------------+----------------+-----------------+------[...]
{'fraction_non_alphanumeric': 0.4204152249134948, 'fraction_numerical': 0.0028835063437139563, 'mean_word_length': 1.5514705882352942, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '124976', 'license': 'MIT', 'n_tokens_mistral': 513, 'n_tokens_neox': 475, 'n_words': 41, 'path': 'code/pyspark_sql.ipynb', 'repo_name': 'ZacksAmber/Disaster-Response-Pipelines', 'size': '1734'}