简体   繁体   English

pyspark 中 spark.sql() 和 cursor.execute 的区别?

[英]Difference between spark.sql() and cursor.execute in pyspark?

what is difference in working of both.两者的工作有何不同。 as i am getting result in executing below command.因为我在执行以下命令时得到结果。

spark.sql("select * from MetadataTable").show()

but when i am trying to run cursor.execute("select * from MetadataTable") , it is showing me error但是当我尝试运行cursor.execute("select * from MetadataTable") ,它向我显示错误

"metadatatable" does not exist “元数据表”不存在

what should I do access table "metadatatable" by cursor.execute ?我应该怎么做通过cursor.execute访问表“元数据表”?

At a glance, spark.sql is the spark way to use SQL to work with your data.一目了然,spark.sql 是使用 SQL 处理数据的火花方式。

Cursor.execute does not appear to be spark code. Cursor.execute 似乎不是火花代码。

Perhaps it is python code for interaction with a database.也许它是与数据库交互的python代码。

You could share the documentation if this seems wrong, but probably reviewing the documentation should explain what it is.如果这看起来不对,您可以共享文档,但可能查看文档应该解释它是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM