下面的吡火花代码将将数据复制到Azure SQL数据库中的默认dbo架构。
test2.write.mode("overwrite") \
.format("jdbc") \
.option("url", jdbcUrl) \
.option("dbtable", 'UpdatedProducts')\
.save()但是,我们在数据库中有多个模式。
我们有一个名为OCC的架构。有人能修改代码以允许我们将数据复制到架构OCC吗?
发布于 2022-11-29 17:42:46
“谢谢你,”亚历克斯·奥特(Alex)回答道,“这对其他社区成员来说是有用的。”
我尝试在我的环境中复制相同的结果,并在dbo.schema:中得到了以下结果

如果您有多个模式,请使用连接和生成作为schema.table_name。
l_schemas=["OCC","dbo","one"]# list for storing your schemas
l_tables=["table1","table2","table3"] # list for storing respective tables in that particular indexed schema
for i in range(0,len(l_schemas)):
s=l_schemas[i]+"."+l_tables[i] # concatenation and making as schema.table_name
df.write.mode("overwrite") \
.format("jdbc") \
.option("url", jdbcUrl) \
.option("dbtable", s)\
.save()https://stackoverflow.com/questions/74613135
复制相似问题