GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — databricks-sql-python/examples/interactive_oauth.py at main · VarijaK/databricks-sql-python Expand file tree/ Copy pathinteractive_oauth.pyMore file actions 29 lines (23 loc) · 987 Bytes / Copy pathinteractive_oauth.pyFile metadata and controls29 lines (23 loc) · 987 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 from databricks import sql import os """databricks-sql-connector supports user to machine OAuth login which means the end user has to be present to login in a browser which will be popped up by the Python process. Pre-requisites: - You have installed a browser (Chrome, Firefox, Safari, Internet Explorer, etc) that will be accessible on the machine for performing OAuth login. This code does not persist the auth token. Hence after the Python process terminates the end user will have to login again. See examples/persistent_oauth.py to learn about persisting the token across script executions. """ with sql.connect( server_hostname=os.getenv("DATABRICKS_SERVER_HOSTNAME"), http_path=os.getenv("DATABRICKS_HTTP_PATH"), ) as connection: for x in range(1, 100): cursor = connection.cursor() cursor.execute("SELECT 1+1") result = cursor.fetchall() for row in result: print(row) cursor.close() connection.close() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |