![](/img/trans.png)
[英]How can I extract data from SQLite in a server page, and use the data in a different javascript file?
[英]How can I pull data from a .sqlite file into Databricks Spark?
我在 Kaggle 上找到了一個我喜歡的數據集,但是唯一的下載選項是包含三個表的 .sqlite 文件。 無論如何我可以從 Databricks 訪問這些數據嗎?
如果您使用的是 pyspark 和 SQLContext,請嘗試以下代碼。
將 extraClassPath 添加到您的 spark conf 中。 spark.executor.extraClassPath=<jdbc.jar>
代碼片段:
from pyspark import SparkContext
sc = SparkContext.getOrCreate()
from pyspark.sql import SQLContext
sqlCtx = SQLContext(sc)
sqlContext.read.format("jdbc").options(
url="jdbc:sqlite:{folder_path}/{file_name}.db",
driver="org.sqlite.JDBC",
dbtable="employee")
.load().take(10)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.