Coder Social home page Coder Social logo

data_loaderを使ってテーブルにデータを投入する際に一部のカラムのみデータを入力した状態でもINSERTしたい about scalardb HOT 4 CLOSED

scalar-labs avatar scalar-labs commented on May 20, 2024
data_loaderを使ってテーブルにデータを投入する際に一部のカラムのみデータを入力した状態でもINSERTしたい

from scalardb.

Comments (4)

scalarindetail avatar scalarindetail commented on May 20, 2024

@scalar-kato
結果
テストしたところ、テーブルのフォーマットとデータのフォーマットが異なる場合、エラーが発生しました, それ以外は問題ありませんでした。Scalardb 2.x.x, と 3.0.0 使用した.

動けるのやり方

// table_format.json
{
  "test.sample": {
    "transaction": true,
    "partition-key": [
      "c1"
    ],
    "clustering-key": [
      "c2"
    ],
    "columns": {
      "c1": "TEXT",
      "c2": "TEXT"
    }
  }
}
// data.json
[{
  "c1": "foo",
  "c2": "bar"
}]
それとも
[{
  "c1": "foo",
  "c2": "bar",
  "c3": "",
}]
// 実行するのコマンド
build/install/data_loader/bin/data_loader --properties=src/main/resources/scalardb.properties --table-schema=src/main/resources/table.json --data-file=src/main/resources/data.json
// データベースで
 c1       | c2   | before_c2 | before_c3 | before_tx_committed_at | before_tx_id | before_tx_prepared_at | before_tx_state | before_tx_version | c3   | tx_committed_at | tx_id                                | tx_prepared_at | tx_state | tx_version
----------+------+-----------+-----------+------------------------+--------------+-----------------------+-----------------+-------------------+------+-----------------+--------------------------------------+----------------+----------+------------
      sad | help |      null |      null |                   null |         null |                  null |            null |              null |      |   1618371834744 | d5c177a5-4c5d-4ef2-8867-41e87b95cad3 |  1618371834607 |        3 |          1
    sadss | help |      null |      null |                   null |         null |                  null |            null |              null |  123 |   1618372084147 | 5514574a-f89e-460b-af82-d373d1a4eb3d |  1618372084088 |        3 |          1
   sadss1 | help |      null |      null |                   null |         null |                  null |            null |              null |      |   1618372097629 | 10ea2783-a998-4214-abad-7b393dbab87f |  1618372097560 |        3 |          1
 sadss112 | help |      null |      null |                   null |         null |                  null |            null |              null | null |   1618372289174 | a26b5bde-eb83-4009-ae55-e8b2b86225d1 |  1618372289122 |        3 |          1
  sadss11 | help |      null |      null |                   null |         null |                  null |            null |              null | null |   1618372223439 | aa941be1-b98c-491a-b243-327f126da6f3 |  1618372223381 |        3 |          1

Additional Context
因みに、どのようにしてデータベースにデータを挿入するのかを知りたいのですが、データやテーブルのフォーマットを見せてもいいんですか?

また、どのようにしてエラーをリプロデュースすることができますか?

from scalardb.

scalar-kato avatar scalar-kato commented on May 20, 2024

@scalarindetail
実際のテーブルではないですが、例えばこのようなテーブル構成でテーブルを作成し、

// table_format.json
{
  "test.sample": {
    "transaction": true,
    "partition-key": [
      "c1"
    ],
    "clustering-key": [
      "c2"
    ],
    "columns": {
      "c1": "TEXT",
      "c2": "TEXT",
      "c3": "TEXT",
      "c4": "TEXT"
    }
  }
}

下のようなデータ挿入を行いたいです。
今はエラーになると思います。

// data1.json
[{
  "c1": "foo",
  "c2": "bar"
}]

挿入するデータを下のようにするとエラーが起こらないことは把握していますが、私たちがやりたいことはdata1.jsonのやり方です。

// data2.json
[{
  "c1": "foo",
  "c2": "bar",
  "c3": "hoge",
  "c4": "hogehoge",
}]

from scalardb.

scalarindetail avatar scalarindetail commented on May 20, 2024

@scalar-kato
なるほど、そ言えば、data loaderのソースコードを修正が必要です。

from scalardb.

feeblefakie avatar feeblefakie commented on May 20, 2024

The existing data loader is obsolete and not maintained anymore. We are working on a new data loader, so please wait for a moment.

from scalardb.

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.