Skip to content

Could DuckDBClient load (CSV) files by URL ? #379

Description

@ericemc3

I'd like an equivalent of
gentoo = d3.csv("https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.7&entityid=e03b43c924f226486f2f0ab6709d2381", d3.autoType)

with DuckDBClient.

both

DuckDBClient.of({
    gentoo: "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.7&entityid=e03b43c924f226486f2f0ab6709d2381"
})

and

DuckDBClient.of({
    gentoo: {
      file: "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.7&entityid=e03b43c924f226486f2f0ab6709d2381"
    }
})

won't work.

But this, simulating a FileAttachment structure, will work:

db =  {
  const gentoo = {
    url : () => "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.7&entityid=e03b43c924f226486f2f0ab6709d2381",
    mimeType: 'text/csv',
    name: 'gentoo'
  }
  
  return DuckDBClient.of({
    gentoo: {file: gentoo}
  })
}

although it's rather complicated to memorize.

I would dream of something simple and intuitive like:

DuckDBClient.of({
    gentoo: {
      url: "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.7&entityid=e03b43c924f226486f2f0ab6709d2381",
      fileType: "csv"
    }
})

with fileType that could also be 'json' for instance (or 'parquet', 'arrow'...).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions