You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importtypingastfromdatetimeimportdatetimeimportpandasaspdfrompyspark.sqlimportDataFrame, functionsfromsqlmeshimportExecutionContext, model@model("docs_example.pyspark",columns={"id": "int","name": "text","country": "text", },)defexecute(
context: ExecutionContext,
start: datetime,
end: datetime,
execution_time: datetime,
**kwargs: t.Any,
) ->DataFrame:
# get the upstream model's name and register it as a dependencytable=context.resolve_table("upstream_model")
# use the spark DataFrame api to add the country columndf=context.spark.table(table).withColumn("country", functions.lit("USA"))
# returns the pyspark DataFrame directly, so no data is computed locallyreturndf
The text was updated successfully, but these errors were encountered:
Requirements:
SQLMesh config:
Python model example:
The text was updated successfully, but these errors were encountered: