Skip to main content

magicdb client cmd tool

Project description

Install

pip install magicdb_cli

Tutorials

Database Operations

List All Databases

show databases;

Create A Database

-- db_name: the name of this database
create database [if not exists] db_name with properties ("k1"="v1", "k2"="v2");

properties MUST CONTAIN these keys:

  1. bucket: bucket name of OSS/S3 example: (s3://bucket-name | oss://test-bucket)
  2. endpoint: endpoint for OSS/S3
  3. access_key: token for account
  4. secret_key: token for account

Delete A Database

drop database [if exists] db_name;

Table Operations

List All Tables Of A Database

-- db_name: the name of this database
show tables db_name;

Drop A Table

-- db_name: the name of this database
drop table [if exists] db_name.table_name;

Create A Table Of A Database

-- db_name: the name of this database
-- table_name: the name of this table
create table [if not exists] db_name.table_name with properties ("k1"="v1", "k2"="v2");

properties MUST CONTAIN these keys:

  1. data: the path to put sqlite files
  2. meta: the path to put meta files

Show Table Info

-- db_name: the name of this database
-- table_name: the name of this table
desc db_name.table_name;
describe db_name.table_name;

Versions Operations

List All Versions Of A Table

-- db_name: the name of this database
-- table_name: the name of this table
show versions db_name.table_name;

Show Current Version Of A Table

-- db_name: the name of this database
-- table_name: the name of this table
show current version db_name.table_name;

Update Current Version Of A Table

-- db_name: the name of this database
-- table_name: the name of this table
-- version1: the name of current version
update table db_name.table_name set current version = "version1";

Drop A Version Of A Table

-- db_name: the name of this database
-- table_name: the name of this table
-- version1: the name of current version

-- if `version1` is current version, then the new current version is set `nil`.
alter table db_name.table_name drop version("version1");

Machine Operations

List ALL Machines of A Database

-- db_name: the name of this database
show machines db_name;

Delete A Machine Of A Database

-- db_name: the name of this database
-- machine_ip: ip of this machine
alter database db_name drop machine("machine_ip");

Add A Machine Of A Database

-- db_name: the name of this database
-- machine_ip: ip of this machine
alter database db_name add machine("machine_ip");

Load And Select Operations

Load Data To A Table

-- db_name: the name of this database
-- table_name: the name of this table
-- properties are optional
-- path: hive table path

load data "path" into db_name.table_name [with with properties ("k1"="v1", "k2":"v2")];

properties MUST CONTAIN these keys:

  1. key: primary key of table

properties MAY CONTAIN these keys:

  1. partitions: partitions to split, default: 100
  2. workdir: where to save the load data, defalue: /tmp/$db_name/$table_name/$timestamp/
  3. workers: process num, default: max(cup()-1, 1)

Select Data From Table

-- db_name: the name of this database
-- table_name: the name of this table
-- key: the primary key value
-- field: the primary key field

select * from db_name.table_name where field = 'key';

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magicdb_cli-1.0.23.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

magicdb_cli-1.0.23-py3-none-any.whl (46.0 kB view details)

Uploaded Python 3

File details

Details for the file magicdb_cli-1.0.23.tar.gz.

File metadata

  • Download URL: magicdb_cli-1.0.23.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for magicdb_cli-1.0.23.tar.gz
Algorithm Hash digest
SHA256 603fac237f4031b67663587ea99d31bd0b88b257b5bf71ec53bb6c06dbfc9318
MD5 c9f457ef3e4ada51155d57a1e4eef408
BLAKE2b-256 0fcd223484065dd5aece0639ec510b3d45c60719222bc4c91469b17070dd3ad7

See more details on using hashes here.

File details

Details for the file magicdb_cli-1.0.23-py3-none-any.whl.

File metadata

  • Download URL: magicdb_cli-1.0.23-py3-none-any.whl
  • Upload date:
  • Size: 46.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for magicdb_cli-1.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 14d2fef41e53c0de0fe18f8f16269b5f3672b7ca7d5ca7137a066184b9fd2951
MD5 5cedf543ad8adb3155b40c42463cbf8d
BLAKE2b-256 a505833a8176c4206c8dabcbbfc36693a6b338364f0e5c56ddfb0c7ec794cc4a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page