Skip to content

Commit

Permalink
inputs.ramp.ramp_raw: option to return list of tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Oct 17, 2024
1 parent 2c676f2 commit 971861d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pypath/inputs/ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def _ramp_sqldump() -> IO:


def ramp_raw(
tables: list[str] = None,
tables: str | list[str] = None,
sqlite: bool = False,
return_df: bool = True,
**kwargs
) -> dict[str, pd.DataFrame, sqlite3.Connection]:
) -> dict[str, list[tuple] | pd.DataFrame | sqlite3.Connection]:
"""
Retrieve RaMP database contents from raw SQL dump.
Expand All @@ -68,6 +69,8 @@ def ramp_raw(
One or more tables to retrieve. If None, all tables are retrieved.
sqlite:
Return an SQLite database instead of a pandas DataFrame.
return_df:
Return a pandas data frame.
kwargs:
Options for the SQLite database: this way you can point to a new
or existing database, while by default, an in-memory, temporary
Expand All @@ -83,7 +86,7 @@ def ramp_raw(
return sqldump.tables(
sqldump = fp,
tables = tables,
return_df = True,
return_df = return_df,
return_sqlite = sqlite,
con_param = kwargs,
source_id = (fp.name, f'{os.path.getmtime(fp.name):.0f}'),
Expand Down

0 comments on commit 971861d

Please sign in to comment.