по jdbc в AWS Glue Job?
from pyspark.context import SparkContext
from awsglue.context import GlueContext
import boto3
sc = SparkContext()
glueContext = GlueContext(sc)
client = boto3.client('secretsmanager')
secret_dict = client.get_secret_value(SecretId='pragmatic-mysql-casino')
spark_df = glueContext.read \
.format("jdbc") \
.option("url", "jdbc:{}://{}:{}/{}".format(secret_dict.get('engine'), secret_dict.get('host'),
secret_dict.get('port'), secret_dict.get('dbname'))) \
.option("dbtable", "(select * from my_tbl where col1 = 'my_value') as my_tbl") \
.option("user", secret_dict.get('username')) \
.option("password", secret_dict.get('password')) \
.load()
Получаю ошибку
Py4JJavaError: An error occurred while calling o87.load. java.lang.NullPointerException
Что он хочет (( Подскажите пожалуйста, Спасибо!
а еще есть логи?
2021-06-22 19:10:51,635 ERROR [main] glue.ProcessLauncher (Logging.scala:logError(70)): Error from Python:Traceback (most recent call last): File "/tmp/python_script_job.py", line 47, in <module> .option("password", secret_dict.get('password')) \ File "/opt/amazon/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 172, in load return self._df(self._jreader.load()) File "/opt/amazon/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in call answer, self.gateway_client, self.target_id, self.name) File "/opt/amazon/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco return f(*a, **kw) File "/opt/amazon/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get_return_value format(target_id, ".", name), value) py4j.protocol.Py4JJavaError: An error occurred while calling o87.load. : java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:460) at java.util.Properties.setProperty(Properties.java:166) at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions$$anonfun$1.apply(JDBCOptions.scala:48) at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions$$anonfun$1.apply(JDBCOptions.scala:48) at scala.collection.immutable.Map$Map4.foreach(Map.scala:188) at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions.<init>(JDBCOptions.scala:48) at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions.<init>(JDBCOptions.scala:35) at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:32) at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318) at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748)
лучше бы в pastebin или gist
Сорян, в след раз закину Честно мне иногда легче скопировать с телеги и вставить в свой Notepad++ ))
Неа, ща нашел что я всё таки секретку не правильно дергал
Обсуждают сегодня