I am trying to do store a simple string as a text file in datalakeGen2 with python code written in synapse notebook. But it doesn't seems to be straight forward.
I tried to convert the text into rdd and then store:
from pyspark import SparkConf
from pyspark import SparkContext
sc = SparkContext.getOrCreate(SparkConf().setMaster("local[*]"))
str = "test string"
text_path = adls_path + 'test.xml'
rdd_text = sc.parallelize(list(str)).collect()
# type(rdd_text)
rdd_text.saveAsTextFile(text_path)
but it gives out error as:
AttributeError: 'list' object has no attribute 'saveAsTextFile'
Traceback (most recent call last):
AttributeError: 'list' object has no attribute 'saveAsTextFile'