Skip to content

running out of memory trying to write SQL #1874

Closed
@lstillwe

Description

@lstillwe

Python version:3
xarray version: 0.9.6

I am using xarray to read very large NetCDF files (~47G).

Then I need to write the data to a postgres DB. I have tried parsing the array and using an INSERT for every row, but this is taking a very long time (weeks).

I have read that bulk insert would be a lot faster, so I am looking for a solution along those lines.

I also saw that Pandas has a DataFrame.to_sql() function and xarray has Dataset.to_dataframe() function, so I was trying out this approach. However, when trying to convert my xarray Dataset to a Pandas Dataframe, I ran out of memory quickly.
Is this expected behavior? If so can you suggest another solution to this problem?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions