remove Value error "pyspark is not installed. Please install it with `pip i… (#9723)

Description: You cannot execute spark_sql with versions prior to 3.4 due
to the introduction of pyspark.errors in version 3.4.
And if you are below you get 3.4 "pyspark is not installed. Please
install it with pip nstall pyspark" which is not helpful. Also if you
not have pyspark installed you get already the error in init. I would
return all errors. But if you have a different idea feel free to
comment.

Issue: None
Dependencies: None
Maintainer:

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
Jurik-001 2023-08-25 07:18:55 +02:00 committed by GitHub
parent 30151c99c7
commit d04fe0d3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,14 +179,8 @@ class SparkSQL:
If the statement throws an error, the error message is returned.
"""
try:
from pyspark.errors import PySparkException
except ImportError:
raise ValueError(
"pyspark is not installed. Please install it with `pip install pyspark`"
)
try:
return self.run(command, fetch)
except PySparkException as e:
except Exception as e:
"""Format the error message"""
return f"Error: {e}"