Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import CSV? #114

Closed
geo-systems opened this issue May 19, 2020 · 2 comments
Closed

Import CSV? #114

geo-systems opened this issue May 19, 2020 · 2 comments

Comments

@geo-systems
Copy link

Hi team,

I went through the documentation, but couldn't find a way to import a CSV via this library.

Is there a way to invoke the .import special command via the library?

@theogravity
Copy link
Collaborator

theogravity commented May 21, 2020

If the sqlite3 library supports it, we can as well, but need the documentation to know how to do the implementation.

If you can point out the documentation, I can look into it.

Edit:

I noticed that you created an issue on sqlite3 referencing this PR - TryGhost/node-sqlite3#1086

Since it's not in the library, we can't add support to wrap the call.

However, you can extend the Database class to add the method on your side.

// not working code, just a rough idea of how you can do it
import { Database } from 'sqlite'

class CSVDatabase extends Database {
  import () {
    // definition here
  }  
}

const db = new CSVDatabase(config)

await db.open()

db.import()

@theogravity
Copy link
Collaborator

Closing as this is more for the sqlite3 library and this project is designed to wrap around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants