pathpyG icon indicating copy to clipboard operation
pathpyG copied to clipboard

Load networks from SQL database

Open hackl opened this issue 1 year ago • 1 comments

It would be great to have a more streamlined and user-friendly method for loading networks directly from an SQL database. Currently, the process works using the following code:

conn = sqlite3.connect("networks.db")
df_lotr = pd.read_sql_query('SELECT DISTINCT source, target from lotr', conn).rename(columns={"source": "v", "target": "w"})
conn.close()
n_lotr = pp.io.pandas.df_to_graph(df_lotr).to_undirected()

hackl avatar Feb 02 '25 20:02 hackl

I've submitted a PR (#303) implementing this feature. I've implemented the functions in line with the suggestions in #301 for the entire io module.

M-Lampert avatar Nov 13 '25 19:11 M-Lampert