Spaces:
Build error
Build error
pgzmnk
commited on
Commit
•
bcea7da
1
Parent(s):
ea93f83
Clean-up motherduck auth.
Browse files- .gitignore +2 -0
- app.py +4 -7
.gitignore
CHANGED
@@ -3,3 +3,5 @@ __pycache__/
|
|
3 |
service_account.json
|
4 |
ee_service_account.json
|
5 |
md_service_token.txt
|
|
|
|
|
|
3 |
service_account.json
|
4 |
ee_service_account.json
|
5 |
md_service_token.txt
|
6 |
+
.env
|
7 |
+
.vscode
|
app.py
CHANGED
@@ -171,15 +171,12 @@ class IndexGenerator:
|
|
171 |
return df
|
172 |
|
173 |
def set_up_duckdb(service_token_file=None):
|
174 |
-
print('
|
175 |
# use `climatebase` db
|
176 |
-
if
|
177 |
-
|
178 |
-
md_service_token=f.read()
|
179 |
-
|
180 |
-
os.environ['motherduck_token'] = md_service_token
|
181 |
-
con = duckdb.connect('md:climatebase')
|
182 |
else:
|
|
|
183 |
con = duckdb.connect(':climatebase:')
|
184 |
con.sql("USE climatebase;")
|
185 |
|
|
|
171 |
return df
|
172 |
|
173 |
def set_up_duckdb(service_token_file=None):
|
174 |
+
print('set up duckdb')
|
175 |
# use `climatebase` db
|
176 |
+
if not os.getenv('motherduck_token');
|
177 |
+
raise Exception('No motherduck token found. Please set the `motherduck_token` environment variable.')
|
|
|
|
|
|
|
|
|
178 |
else:
|
179 |
+
con = duckdb.connect('md:climatebase')
|
180 |
con = duckdb.connect(':climatebase:')
|
181 |
con.sql("USE climatebase;")
|
182 |
|