简体   繁体   English

我可以使用 aws 胶水在 sql 服务器中创建表/写入表吗?

[英]Can I create table/write into a table in sql server using aws glue?

Can I create table/write into a table in sql server using aws glue?我可以使用 aws 胶水在 sql 服务器中创建表/写入表吗? I am using pyspark (mssqljdbc) for reading the data, but I don't know how to write into a table.我正在使用 pyspark (mssqljdbc) 读取数据,但我不知道如何写入表。

I can connect to the SQL server, but I am trying to create tables using DDL (other than read/write).我可以连接到 SQL 服务器,但我正在尝试使用 DDL(读/写除外)创建表。 Here is the sample I am using for read.这是我用于阅读的示例。
Please share if anyone have sample code.如果有人有示例代码,请分享。 Thanks谢谢

df = spark.read.format(i['type']) \
        .option("url", "jdbc:sqlserver://" + i['host'] + ":" + i['port'] + ";databaseName=" + i['database']) \
        .option("user", i['user']) \
        .option("password", i['password'])\
        .option("dbtable",i['table'])\
        .option("partitionColumn", i['partitioncol']) \
        .option("lowerBound", i['lowerbound']) \
        .option("upperBound", i['upperbound']) \
        .option("numPartitions", i['partitionnum']) \
        .option("driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver") \
        .load()

Yes, you can use normal pyspark code on Glue, but you will need to create a Glue Connection , so that you can connect to your SQL server.是的,您可以在 Glue 上使用普通的 pyspark 代码,但是您需要创建一个Glue Connection ,以便您可以连接到您的 SQL 服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM