![](/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.