-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reformatted all the files using black (#448)
Reformatted the files using black
- Loading branch information
1 parent
08f14a0
commit 97c815e
Showing
36 changed files
with
1,521 additions
and
580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
from databricks import sql | ||
import os | ||
|
||
with sql.connect(server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path = os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token = os.getenv("DATABRICKS_TOKEN")) as connection: | ||
with sql.connect( | ||
server_hostname=os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path=os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token=os.getenv("DATABRICKS_TOKEN"), | ||
) as connection: | ||
|
||
with connection.cursor() as cursor: | ||
cursor.execute("CREATE TABLE IF NOT EXISTS squares (x int, x_squared int)") | ||
with connection.cursor() as cursor: | ||
cursor.execute("CREATE TABLE IF NOT EXISTS squares (x int, x_squared int)") | ||
|
||
squares = [(i, i * i) for i in range(100)] | ||
values = ",".join([f"({x}, {y})" for (x, y) in squares]) | ||
squares = [(i, i * i) for i in range(100)] | ||
values = ",".join([f"({x}, {y})" for (x, y) in squares]) | ||
|
||
cursor.execute(f"INSERT INTO squares VALUES {values}") | ||
cursor.execute(f"INSERT INTO squares VALUES {values}") | ||
|
||
cursor.execute("SELECT * FROM squares LIMIT 10") | ||
cursor.execute("SELECT * FROM squares LIMIT 10") | ||
|
||
result = cursor.fetchall() | ||
result = cursor.fetchall() | ||
|
||
for row in result: | ||
print(row) | ||
for row in result: | ||
print(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
from databricks import sql | ||
import os | ||
|
||
with sql.connect(server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path = os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token = os.getenv("DATABRICKS_TOKEN")) as connection: | ||
with sql.connect( | ||
server_hostname=os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path=os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token=os.getenv("DATABRICKS_TOKEN"), | ||
) as connection: | ||
|
||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT * FROM default.diamonds LIMIT 2") | ||
result = cursor.fetchall() | ||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT * FROM default.diamonds LIMIT 2") | ||
result = cursor.fetchall() | ||
|
||
for row in result: | ||
print(row) | ||
for row in result: | ||
print(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
from databricks import sql | ||
import os | ||
|
||
with sql.connect(server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path = os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token = os.getenv("DATABRICKS_TOKEN"), | ||
_user_agent_entry="ExamplePartnerTag") as connection: | ||
with sql.connect( | ||
server_hostname=os.getenv("DATABRICKS_SERVER_HOSTNAME"), | ||
http_path=os.getenv("DATABRICKS_HTTP_PATH"), | ||
access_token=os.getenv("DATABRICKS_TOKEN"), | ||
_user_agent_entry="ExamplePartnerTag", | ||
) as connection: | ||
|
||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT * FROM default.diamonds LIMIT 2") | ||
result = cursor.fetchall() | ||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT * FROM default.diamonds LIMIT 2") | ||
result = cursor.fetchall() | ||
|
||
for row in result: | ||
print(row) | ||
for row in result: | ||
print(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.