<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error while writing Data Frame from Azure Databricks to Azure synapse Dedicated Pool in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31373#M22832</link>
    <description>&lt;P&gt;I am reading delta tables from my Databricks workspace as DF and then I am trying to write this DF into Azure Synapse Dedicated SQL Pool, but I am getting error like:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Py4JJavaError: An error occurred while calling o1509.save.
: com.databricks.spark.sqldw.SqlDWSideException: Azure Synapse Analytics failed to execute the JDBC query produced by the connector.
Underlying SQLException(s):
  - com.microsoft.sqlserver.jdbc.SQLServerException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.  [ErrorCode = 110813] [SQLState = S0001]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Below is my code:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from pyspark.sql import *
from pyspark.sql.types import *
from pyspark.sql.functions import *
&amp;nbsp;
dwDatabase = "sqldbpool"
dwServer = "synapseworkspace.database.windows.net"
dwUser = "user"
dwPass = "pass"
dwJdbcPort =  "1433"
dwJdbcExtraOptions = "encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
sqlDwUrl = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass + ";$dwJdbcExtraOptions"
sqlDwUrlSmall = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass
&amp;nbsp;
spark.conf.set(
    "spark.sql.parquet.writeLegacyFormat",
    "true")
&amp;nbsp;
df = StarSchemaDict['Product_Dim'] # The value of the dictionary is a DF.
&amp;nbsp;
(df
 .write
 .format("com.databricks.spark.sqldw")
 .option("url", sqlDwUrlSmall)
 .option("dbtable", "Product_Dim")
 .option( "forward_spark_azure_storage_credentials","True")
 .option("tempdir", adls)
 .mode("overwrite")
 .save())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The data is getting copied to my adls staging area but after that it is throwing an error.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 15:28:43 GMT</pubDate>
    <dc:creator>rahul08yadav</dc:creator>
    <dc:date>2022-09-19T15:28:43Z</dc:date>
    <item>
      <title>Error while writing Data Frame from Azure Databricks to Azure synapse Dedicated Pool</title>
      <link>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31373#M22832</link>
      <description>&lt;P&gt;I am reading delta tables from my Databricks workspace as DF and then I am trying to write this DF into Azure Synapse Dedicated SQL Pool, but I am getting error like:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Py4JJavaError: An error occurred while calling o1509.save.
: com.databricks.spark.sqldw.SqlDWSideException: Azure Synapse Analytics failed to execute the JDBC query produced by the connector.
Underlying SQLException(s):
  - com.microsoft.sqlserver.jdbc.SQLServerException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.  [ErrorCode = 110813] [SQLState = S0001]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Below is my code:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from pyspark.sql import *
from pyspark.sql.types import *
from pyspark.sql.functions import *
&amp;nbsp;
dwDatabase = "sqldbpool"
dwServer = "synapseworkspace.database.windows.net"
dwUser = "user"
dwPass = "pass"
dwJdbcPort =  "1433"
dwJdbcExtraOptions = "encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
sqlDwUrl = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass + ";$dwJdbcExtraOptions"
sqlDwUrlSmall = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass
&amp;nbsp;
spark.conf.set(
    "spark.sql.parquet.writeLegacyFormat",
    "true")
&amp;nbsp;
df = StarSchemaDict['Product_Dim'] # The value of the dictionary is a DF.
&amp;nbsp;
(df
 .write
 .format("com.databricks.spark.sqldw")
 .option("url", sqlDwUrlSmall)
 .option("dbtable", "Product_Dim")
 .option( "forward_spark_azure_storage_credentials","True")
 .option("tempdir", adls)
 .mode("overwrite")
 .save())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The data is getting copied to my adls staging area but after that it is throwing an error.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 15:28:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31373#M22832</guid>
      <dc:creator>rahul08yadav</dc:creator>
      <dc:date>2022-09-19T15:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error while writing Data Frame from Azure Databricks to Azure synapse Dedicated Pool</title>
      <link>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31375#M22834</link>
      <description>&lt;P&gt;The issue was getting created because I was passing SAS Token for setting the configuration for Storage Account instead of Storage Access Key. It's working now without any issue..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;spark.conf.set("fs.azure.account.key.datalakestorage.dfs.core.windows.net",dbutils.secrets.get(scope = "databricks-scope",key = "StorageAccessKey"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't know why the error shows " The input is not a valid Base-64 string as it contains a non-base 64 character" but the issue was related to Storage Access Key.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 12:21:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31375#M22834</guid>
      <dc:creator>rahul08yadav</dc:creator>
      <dc:date>2022-09-21T12:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Error while writing Data Frame from Azure Databricks to Azure synapse Dedicated Pool</title>
      <link>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31374#M22833</link>
      <description>&lt;P&gt;Hi, If you have encoded any section in the code, could you please decode &amp;gt; re-encode and try again?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 20:59:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-while-writing-data-frame-from-azure-databricks-to-azure/m-p/31374#M22833</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2022-09-20T20:59:46Z</dc:date>
    </item>
  </channel>
</rss>

