Can I load a pandas dataframe from a Postgres dump file?

62 views Asked by At

My Postgres database is locked on a server with no external connectivity, but I can run pg_dump and download the file.

The database contains about 30 tables, but I only need three or four for the dataframe. They are relational, but they share straightforward IDs, so I don't think that will present any issues.

To be specific, the data is trading logs, and I want to use pandas to analyze the Trade Plans and the resulting trades. At most, there would be tens or hundreds of thousands of Trade Plans and roughly 4 to 20 executions per Trade Plan. I don't think the size of the data is anything out of the ordinary.

The tables I need are trade_plans, executions, and closed_positions.

As mentioned in one of the comments, I suppose one possibility is to load the dump file into an available Postgres server and connect pandas to it, but that is not trivial given a large community of users.

Is there any way to load the data into pandas from the dump file?

If pandas doesn't offer this capability, I wonder if there is a utility out there that could convert the dump file to a pandas-friendly format.

I am open to suggestions.

0

There are 0 answers