<?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: SQLAlchemy ORM Connection String Error in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31159#M22672</link>
    <description>&lt;P&gt;Hi Ryan &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes the item 2 Python SQL Connector is the first thing I tried before I was asked to explore on the ORM option. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if the SQL connector works, I still need to install the Simba driver? Do I need to install this driver in my local server where I run flask or do I need to install this in Databrick cluster? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought since SQL connector can work, maybe I do not need another driver. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2022 21:16:57 GMT</pubDate>
    <dc:creator>Frank</dc:creator>
    <dc:date>2022-09-23T21:16:57Z</dc:date>
    <item>
      <title>SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31155#M22668</link>
      <description>&lt;P&gt;We tried to insert records to Delta table using ORM. It looks like only SQLAlchemy has option to connect to Delta table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We tried the following code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from sqlalchemy import Column, String, DateTime, Integer, create_engine 
&amp;nbsp;
engine = create_engine("databricks+pyhive://token:&amp;lt;mytoken&amp;gt;@dbc-5a522242-184b.cloud.databricks.com:443/default", connect_args={"http_path": "/sql/1.0/endpoints/955e53e5f53e8105"}, echo=True)
&amp;nbsp;
&amp;nbsp;
engine = create_engine("databricks+pyhive://token:&amp;lt;mytoken&amp;gt; @dbc-5a522242-184b.cloud.databricks.com:443/default", connect_args={"cluster": "Starter Warehouse"}, echo=True)
&amp;nbsp;
&amp;nbsp;
Base.metadata.create_all(engine)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But there is errors&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EOFError                                  Traceback (most recent call last)
&amp;lt;command-1061455742937075&amp;gt; in &amp;lt;module&amp;gt;
      1 # 3 - create table in db (migration)
      2 print(BASE_DIR)
----&amp;gt; 3 Base.metadata.create_all(engine)
&amp;nbsp;
/local_disk0/pythonVirtualEnvDirs/virtualEnv-7c147b6d-75bb-4981-8ab3-879a1c8e5fa7/lib/python3.8/site-packages/sqlalchemy/sql/schema.py in create_all(self, bind, tables, checkfirst)
   4915         if bind is None:
   4916             bind = _bind_or_error(self)
-&amp;gt; 4917         bind._run_ddl_visitor(
   4918             ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
   4919         )
&amp;nbsp;
/local_disk0/pythonVirtualEnvDirs/virtualEnv-7c147b6d-75bb-4981-8ab3-879a1c8e5fa7/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _run_ddl_visitor(self, visitorcallable, element, **kwargs)
   3225 
   3226     def _run_ddl_visitor(self, visitorcallable, element, **kwargs):
-&amp;gt; 3227         with self.begin() as conn:
   3228             conn._run_ddl_visitor(visitorcallable, element, **kwargs)
   3229 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 19:55:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31155#M22668</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-21T19:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31156#M22669</link>
      <description>&lt;P&gt;Hi @Frank Zhang​&amp;nbsp;, I have not seen someone try this yet. Why are you looking to write data to delta using ORM? Is there some documentation/blog you are following to do this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typically you could just use df.write.saveAsTable to save data to delta. &lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 22:12:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31156#M22669</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2022-09-21T22:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31157#M22670</link>
      <description>&lt;P&gt;Below are some examples. There is a library also for that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/dropbox/PyHive/issues/305" target="test_blank"&gt;https://github.com/dropbox/PyHive/issues/305&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://dev.to/fruiza/build-a-python-flask-api-for-your-delta-lake-3bgf" target="test_blank"&gt;https://dev.to/fruiza/build-a-python-flask-api-for-your-delta-lake-3bgf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess we are open to other ways. This is only related with the ingestion data side. We have some transactions that we want to read in. Using ORM can make sure other existing app and code can work with it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 22:30:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31157#M22670</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-22T22:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31158#M22671</link>
      <description>&lt;P&gt;@Frank Zhang​&amp;nbsp;- I see that makes sense. So you are not coding in a Databricks notebook correct? You have a Flask application you developed that is running against Databricks cluster/warehouse. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - If I understand correctly (as stated above). Do you have the &lt;A href="https://www.databricks.com/spark/jdbc-drivers-download" alt="https://www.databricks.com/spark/jdbc-drivers-download" target="_blank"&gt;driver&lt;/A&gt; installed? I think this would likely require you to use a Simba Driver to create the connection. I think this would be the only way to use ORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 - If you don't want to a driver you can use the Python Connector for Databricks. Check out this &lt;A href="https://medium.com/@24chynoweth/using-the-python-connector-for-databricks-sql-fca24d432bed" alt="https://medium.com/@24chynoweth/using-the-python-connector-for-databricks-sql-fca24d432bed" target="_blank"&gt;blog&lt;/A&gt; I wrote that connects a flask application. Note that I don't think ORM would work here but you may be able to find a way to do so. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that helpful?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 17:45:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31158#M22671</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2022-09-23T17:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31159#M22672</link>
      <description>&lt;P&gt;Hi Ryan &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes the item 2 Python SQL Connector is the first thing I tried before I was asked to explore on the ORM option. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if the SQL connector works, I still need to install the Simba driver? Do I need to install this driver in my local server where I run flask or do I need to install this in Databrick cluster? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought since SQL connector can work, maybe I do not need another driver. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 21:16:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31159#M22672</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-23T21:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31160#M22673</link>
      <description>&lt;P&gt;I tried to install the JDBC driver on MAC OS. I am using Python code. Can I still use this driver? Is there a doc on how to install it on Mac? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;“DatabricksJDBC42.jar” cannot be opened because it is from an unidentified developer.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 23:39:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31160#M22673</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-23T23:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31161#M22674</link>
      <description>&lt;P&gt;Hi @Frank Zhang​&amp;nbsp;, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please disregard the driver comment. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Python SQL Connector requires no driver. Just a pip install and you are good to go. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The links you provided don't actually show a working example of using SQL Alchemy's ORM to connect to Databricks. It looks like someone created a &lt;A href="https://github.com/crflynn/databricks-dbapi" alt="https://github.com/crflynn/databricks-dbapi" target="_blank"&gt;library&lt;/A&gt; to do this that is not part of the SQLAlchemy project to solve this problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While I am not certain I do &lt;B&gt;not&lt;/B&gt; believe you can use SQLAlchemy ORM to read the data. My recommendation would be to use the Python SQL Connector. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are reading the data, where are you reading it from? Application or Databricks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 15:42:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31161#M22674</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2022-09-26T15:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31162#M22675</link>
      <description>Hi Ryan&lt;BR /&gt;How come the Redash can use Flask and SQLAlchemy ORM for Delta Lake?&lt;BR /&gt;We can use SQL for now but it will be good to know which way is better? The SQL connector is super slow for some reason.&lt;BR /&gt;  1.  Is there other data ingestion method you recommend for fast and transactional data?&lt;BR /&gt;  2.  Why Redash is using ORM? Is it faster than SQL?&lt;BR /&gt;  3.  Currently in query analyzer, each query is planning time is 2S why the planning time so long with SQL connector?&lt;BR /&gt;Thanks,</description>
      <pubDate>Tue, 27 Sep 2022 02:28:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31162#M22675</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-27T02:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31163#M22676</link>
      <description>Thanks Ryan for your help and inputs.&lt;BR /&gt;When you are reading the data, where are you reading it from? Application or Databricks?&lt;BR /&gt;We got the data from machine learning machines. They will generate the metrics at a constant rate.&lt;BR /&gt;We need to put those data somewhere, for example Delta lake.&lt;BR /&gt;The front end dashboard will read the data. It could be some aggregated function on the raw data, for example min/max/average of the raw data. We will not use Databrick to read the data.</description>
      <pubDate>Tue, 27 Sep 2022 02:31:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31163#M22676</guid>
      <dc:creator>Frank</dc:creator>
      <dc:date>2022-09-27T02:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQLAlchemy ORM Connection String Error</title>
      <link>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31164#M22677</link>
      <description>&lt;P&gt;Do you have an example of Redash+SQLAlchemy ORM? It could be possible I just can't find an example of it to take a look. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few follow up questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;How much data are you reading? &lt;/LI&gt;&lt;LI&gt;What size SQL warehouse are you using? &lt;/LI&gt;&lt;LI&gt;How long is it taking? &lt;/LI&gt;&lt;LI&gt;Why are you using Redash instead of Databricks SQL?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 13:21:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sqlalchemy-orm-connection-string-error/m-p/31164#M22677</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2022-09-27T13:21:18Z</dc:date>
    </item>
  </channel>
</rss>

