Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
lfunderburk committed Dec 4, 2023
1 parent cf8c220 commit ef41acc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions mini-projects/end-to-end/app.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import plotly.express as px\n",
"import duckdb\n",
"import os\n",
Expand All @@ -43,11 +42,11 @@
"source": [
"load_dotenv()\n",
"motherduck = os.getenv(\"motherduck\")\n",
" \n",
"\n",
"# initiate the MotherDuck connection through a service token through\n",
"con = duckdb.connect(f'md:?motherduck_token={motherduck}') \n",
"con = duckdb.connect(f\"md:?motherduck_token={motherduck}\")\n",
"\n",
"df = con.sql(\"SELECT * FROM weatherdata\").df()\n"
"df = con.sql(\"SELECT * FROM weatherdata\").df()"
]
},
{
Expand Down
13 changes: 6 additions & 7 deletions mini-projects/end-to-end/dataextraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import duckdb


def extract_weather_by_lat_lon(api_key, lat, lon):
"""
Extracts weather data from RapidAPI
Expand Down Expand Up @@ -105,24 +106,24 @@ def save_to_motherduck(df, motherduck):
df.to_csv("weather_data.csv", index=False)

# initiate the MotherDuck connection through a service token through
con = duckdb.connect(f'md:?motherduck_token={motherduck}')
con = duckdb.connect(f"md:?motherduck_token={motherduck}")

# Delete table weatherdata if exists
con.execute("DROP TABLE IF EXISTS weatherdata");
con.execute("DROP TABLE IF EXISTS weatherdata")

# Create table weatherdata
con.sql("CREATE TABLE weatherdata AS SELECT * FROM 'weather_data.csv'")

except Exception as e:
print("Error:", e)


if __name__ == "__main__":
# Load api key
load_dotenv()
api_key = os.getenv("RapidAPI")
motherduck = os.getenv("motherduck")



# Extract data
latitudes = [
40.7128,
Expand Down Expand Up @@ -173,5 +174,3 @@ def save_to_motherduck(df, motherduck):

# Save to MotherDuck
save_to_motherduck(df, motherduck)


0 comments on commit ef41acc

Please sign in to comment.