In PySpark it you can define a schema and read data sources with this pre-defined schema, e. g.:
Schema = StructType([ Str
If you are looking for a DDL string from PySpark:
df: DataFrame = spark.read.load('LOCATION') schema_json = df.schema.json() ddl = spark.sparkContext._jvm.org.apache.spark.sql.types.DataType.fromJson(schema_json).toDDL()