Giter Club home page Giter Club logo

Comments (6)

thombashi avatar thombashi commented on June 20, 2024

@yajo
Please let me confirm this.
Are the existing options not applicable to your use case?
You can specify a format by using the --format option for sqlitebiter file.
And you can set a format as a positional argument for sqlitebiter stdin.

from sqlitebiter.

yajo avatar yajo commented on June 20, 2024

Yeah, the point is that I want to pass the file through stdin but let sqlitebiter guess the format by a filename that I give in an alternate flag. So that if the file is .CSV or .csv, for example, sqlitebiter does its magic to get the format automatically, without me having to replicate the same magic upper in the stack.

The use case is that I'm integrating sqlitebiter in a system (Odoo) that stores attachments in a content-addressable manner. The file is named asd9f87a9sd8f97987as987d9a8s7d. In the database I know it's called something.xlsx.

I tried by symlinking a something.xlsx to the source file, but sqlitebiter resolves the symlink and ends up without the suffix it needs to know the format.

Thus, I wanted to just let it guess the format based on a filename that I can pass separately. Something like:

sqlitebiter file asd9f87a9sd8f97987as987d9a8s7d --format-from-filename something.xlsx

something.xlsx would not exist in this context. It's just a parameter.

from sqlitebiter.

thombashi avatar thombashi commented on June 20, 2024

@yajo
I intended my previous comment to suggest that you can specify the conversion format using an option or argument.
For example:

$ cat abcdefg   # a CSV format file without extension
A,B,C
ab,1,2
bc,3,4
cd,5,6
$ sqlitebiter file --format csv abcdefg 
[INFO] convert 'abcdefg' to 'abcdefg' table
[INFO] converted results: source=1, success=1, created-table=1
[INFO] database path: out.sqlite

Or

$ cat abcdefg | sqlitebiter stdin csv
[INFO] convert 'stdin' to 'csv1' table
[INFO] converted results: source=1, success=1, created-table=1
[INFO] database path: out.sqlite

Are these methods of executing commands not solving your problem?

from sqlitebiter.

yajo avatar yajo commented on June 20, 2024

Those require my app to know the format of the file. The whole point of this feature request is that I'd love to use sqlitebiter format autodetection, which is already coded here. So do those commands convert the file, but do not solve the issue.

from sqlitebiter.

thombashi avatar thombashi commented on June 20, 2024

I feel that the use cases of the --format-from-filename option is too limited.
How about adding file extension names (xlsx, etc.) support to the --format option?

from sqlitebiter.

yajo avatar yajo commented on June 20, 2024

from sqlitebiter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.