0

how I can submit a code pyspark with Livy? I used this and it works

curl localhost:8998/sessions/0/statements -X POST -H 'Content-Type: application/json' -d '{"code":"srdd.get(\"ak\")"}'

But now i would to pass a command, example this

curl localhost:8998/sessions/69/statements -X POST -H 'Content-Type: application/json' -d  '{“code”: textwrap.dedent("""
from pyspark.sql import *
from pyspark.sql.types import *
B = spark.sql("SELECT * FROM A")
B.collect()”””
}'

but there is syntax error... Who know the just right for write this command?

Thanks

Thank you

  • Simplest solution would be to put the code snippet in file and pass data as location of file instead of code snippet directly...like .. `-d '{"file": "file:/tmp/test.py", "name": "Livy PySpark Example"}"` – Pushkr Mar 13 '18 at 01:20
  • I found a solution, but your solution is nice! Tks – David Marchetti May 03 '18 at 09:16

0 Answers0