Giter VIP home page Giter VIP logo

Comments (4)

thombashi avatar thombashi commented on August 11, 2024 1

Thank you for your reply.

You can add primary key id column as described in the previous comment with sqlitebiter 0.25.0 or newer version. I had added the feature to that version.

Please upgrade sqlitebiter and execute with --add-primary-key <PRIMARY KEY NAME> option like following:

Input: issue60.json

[
    {
        "a": "foo",
        "b": 123
    },
    {
        "a": "bar",
        "b": 456
    }
]

Example execution

$ sqlitebiter --add-primary-key id file issue60.json
[INFO] sqlitebiter file: convert 'issue60.json' to 'issue60' table
[INFO] sqlitebiter file: converted results: source=1, success=1, created-table=1
[INFO] sqlitebiter file: database path: out.sqlite

Output table schema: issue60

Field Type Null Key Default Index Extra
id INTEGER NO PRI NULL X
a TEXT NO NULL
b INTEGER NO NULL

from sqlitebiter.

thombashi avatar thombashi commented on August 11, 2024

Hi @maheshkumar2150

Did you mean adding primary key autoincrement column to the SQLite file while JSON does not include a key column? like the following example:

Input: issue.json

[
    {
        "a": "foo",
        "b": 123
    },
    {
        "a": "bar",
        "b": 456
    }
]

Output (current behavior)

'issue60' (a INTEGER, b INTEGER);
a b
foo 123
bar 456

Output (expected behavior)

'issue60' (id INTEGER PRIMARY KEY AUTOINCREMENT, INTEGER, b INTEGER);
id a b
1 foo 123
2 bar 456

from sqlitebiter.

maheshkumar2150 avatar maheshkumar2150 commented on August 11, 2024

Yes. Exactly, this is what i wanted to ask.
Is it possible?

from sqlitebiter.

maheshkumar2150 avatar maheshkumar2150 commented on August 11, 2024

Super! Thank you so much!!

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.