We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 395af76 commit a1100e9Copy full SHA for a1100e9
1 file changed
src/catalyst_ons_geographies/postcodes.py
@@ -4,15 +4,14 @@
4
import duckdb
5
6
7
-def get_ons_from_postcodes(postcodes):
+def get_ons_from_postcodes(postcodes, db_path='/data/ons_postcodes.duckdb'):
8
'''Get the ONS Geography data from the postcodes'''
9
10
# The path is either data/ or /data/ depending on the environment
11
- db = '/data/ons_postcodes.duckdb'
12
- if not os.path.exists(db):
13
- db = 'data/ons_postcodes.duckdb'
+ if not os.path.exists(db_path):
+ db_path = 'data/ons_postcodes.duckdb'
14
15
- conn = duckdb.connect(database=db, read_only=True)
+ conn = duckdb.connect(database=db_path, read_only=True)
16
17
# For all postcodes in the postcode array, remove any whitespace
18
postcodes = [postcode.replace(' ', '') for postcode in postcodes]
0 commit comments