<?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 Re: Unable to construct the sql url as the password is having special characters. in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/unable-to-construct-the-sql-url-as-the-password-is-having/m-p/23942#M571</link>
    <description>&lt;P&gt;We can use urllib.parse to handle special characters. Here is an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import urllib.parse
user='user@host.mysql.database.azure.com'
&amp;nbsp;
password=urllib.parse.quote_plus("P@test")
host="host.mysql.database.azure.com"
database = "db"
&amp;nbsp;
connect_args={'ssl':{'fake_flag_to_enable_tls': True}}
&amp;nbsp;
connect_string = 'mysql+pymysql://{}:{}@{}/{}'.format(user,password,host,database)
&amp;nbsp;
&amp;nbsp;
engine = create_engine(connect_string, connect_args=connect_args, echo=False)
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 16:06:22 GMT</pubDate>
    <dc:creator>User16753724663</dc:creator>
    <dc:date>2021-06-16T16:06:22Z</dc:date>
    <item>
      <title>Unable to construct the sql url as the password is having special characters.</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/unable-to-construct-the-sql-url-as-the-password-is-having/m-p/23941#M570</link>
      <description>&lt;P&gt;while using the sqlalchemy, unable to connect with sql server from databricks:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;user='user@host.mysql.database.azure.com'
password='P@test'
host="host.mysql.database.azure.com"
database = "db"
connect_args={'ssl':{'fake_flag_to_enable_tls': True}}
connect_string = 'mysql+pymysql://{}:{}@{}/{}'.format(user,password,host,database)
     
engine = create_engine(connect_string, connect_args=connect_args, echo=False)
map = pd.read_sql("SELECT * FROM rig_emissions.tag_lookup", engine)
map['key'] = map['rig'].astype(str)+map['tagpath']
&amp;nbsp;
mapDict = dict(zip(map.key,map.id))
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It returns the below error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(pymysql.err.OperationalError) (2003, 'Can't connect to MySQL server on 'P@test' ([Errno -2] Name or service not known)')&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 12:48:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/unable-to-construct-the-sql-url-as-the-password-is-having/m-p/23941#M570</guid>
      <dc:creator>User16753724663</dc:creator>
      <dc:date>2025-03-21T12:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to construct the sql url as the password is having special characters.</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/unable-to-construct-the-sql-url-as-the-password-is-having/m-p/23942#M571</link>
      <description>&lt;P&gt;We can use urllib.parse to handle special characters. Here is an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import urllib.parse
user='user@host.mysql.database.azure.com'
&amp;nbsp;
password=urllib.parse.quote_plus("P@test")
host="host.mysql.database.azure.com"
database = "db"
&amp;nbsp;
connect_args={'ssl':{'fake_flag_to_enable_tls': True}}
&amp;nbsp;
connect_string = 'mysql+pymysql://{}:{}@{}/{}'.format(user,password,host,database)
&amp;nbsp;
&amp;nbsp;
engine = create_engine(connect_string, connect_args=connect_args, echo=False)
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 16:06:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/unable-to-construct-the-sql-url-as-the-password-is-having/m-p/23942#M571</guid>
      <dc:creator>User16753724663</dc:creator>
      <dc:date>2021-06-16T16:06:22Z</dc:date>
    </item>
  </channel>
</rss>

