Skip to content

Commit 95166fe

Browse files
committed
refactor: rename rdb_file arg to db_path
1 parent 2ecf6d1 commit 95166fe

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/polars_access_mdbtools/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def _path_to_cmd_str(input_path: str | Path) -> str:
3030
return str(input_path.resolve())
3131

3232

33-
def list_table_names(rdb_file: str | Path) -> list[str]:
33+
def list_table_names(db_path: str | Path) -> list[str]:
3434
"""List the names of the tables in a given database using 'mdb-tables'.
3535
36-
:param rdb_file: The MS Access database file.
36+
:param db_path: The MS Access database file.
3737
:return: A list of the tables in a given database.
3838
"""
3939
tables = subprocess.check_output( # noqa: S603
40-
["mdb-tables", "--single-column", _path_to_cmd_str(rdb_file)], # noqa: S607
40+
["mdb-tables", "--single-column", _path_to_cmd_str(db_path)], # noqa: S607
4141
).decode()
4242
return tables.strip().split("\n")
4343

@@ -98,13 +98,13 @@ def _extract_data_type_definitions(defs_str: str) -> dict[str, str]:
9898

9999

100100
def _read_table_mdb_schema(
101-
rdb_file: str | Path,
101+
db_path: str | Path,
102102
table_name: str,
103103
encoding: str = "utf-8",
104104
) -> dict[str, str]:
105105
"""Read the schema of a given database into a dictionary of the mdb-schema output.
106106
107-
:param rdb_file: The MS Access database file.
107+
:param db_path: The MS Access database file.
108108
:param encoding: The schema encoding.
109109
:return: a dictionary of `{column_name: access_data_type}`
110110
"""
@@ -118,7 +118,7 @@ def _read_table_mdb_schema(
118118
"--no-relations",
119119
"--table",
120120
table_name,
121-
str(rdb_file),
121+
str(db_path),
122122
]
123123
cmd_output = subprocess.check_output(cmd) # noqa: S603
124124
cmd_output = cmd_output.decode(encoding)
@@ -170,21 +170,21 @@ def _convert_mdb_schema_to_polars_schema(
170170

171171

172172
def read_table(
173-
rdb_file: str | Path,
173+
db_path: str | Path,
174174
table_name: str,
175175
*,
176176
implicit_string: bool = True,
177177
) -> pl.DataFrame:
178178
"""Read a MS Access database as a Polars DataFrame.
179179
180-
:param rdb_file: The MS Access database file.
180+
:param db_path: The MS Access database file.
181181
:param table_name: The name of the table to process.
182182
:param implicit_string: If True, mark strings and unknown datatypes as `pl.String`.
183183
Otherwise, raise an error on unhandled SQL data types.
184184
:return: a `pl.DataFrame`
185185
"""
186186
schema_encoding = "utf-8"
187-
mdb_schema = _read_table_mdb_schema(rdb_file, table_name, schema_encoding)
187+
mdb_schema = _read_table_mdb_schema(db_path, table_name, schema_encoding)
188188
pl_schema_target = _convert_mdb_schema_to_polars_schema(
189189
mdb_schema,
190190
implicit_string=implicit_string,
@@ -213,7 +213,7 @@ def read_table(
213213
"%Y-%m-%d",
214214
"--datetime-format",
215215
"%Y-%m-%dT%H:%M:%S",
216-
_path_to_cmd_str(rdb_file),
216+
_path_to_cmd_str(db_path),
217217
table_name,
218218
]
219219

0 commit comments

Comments
 (0)