GithubHelp home page GithubHelp logo

Let's take a look at how to dump data of Cassandra DB . We have a example about log a ThingsBoard data from Cassandra.

EC2 type : t3.xlarge

Operating System : Ubuntu 18.04 LTS

openjdk version : "1.8.0_292"

Cassandra version :3.11.2.

python version :3.6.9

DB table : ThingsBoard schema

The same model if need to add a data into DB, execute API "session.execute('INSERT INTO table_name(field_1,field_2....) VALUES (value)')", e.g. Take ThingsBoard data for example

....


session.execute('USE thingsboard')

query = "INSERT INTO ts_kv_latest_cf (entity_type, entity_id, key, long_v, ts) VALUES ('{}', {}, '{}', {}, {})".format("DEVICE", "fd9996f0-5bf1-11ec-9683-d922572fb795", "key-value", 1234,int(time.time()*1000))

try:

    session.execute(query)
    
except Exception as e:

    print(e)

Ming-Shu Wu's Projects

image-processing icon image-processing

simply converting monochromatic bitmaps to graphics monochromatic LCD displays

openssl-encrypting icon openssl-encrypting

Encrypting a file(.txt) encrypting using command /decrypting it with AES256CBC using EVP api of openssl

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.