Supported Data Sources
Data Source Support List
DataBars adopts a plug-in architecture design, loading data sources through plugins. This design gives the system high extensibility, theoretically supporting any type of data source. When new data source support is needed, simply develop the corresponding plugin to integrate it into the system.
| Name | Supported |
|---|---|
| Mysql | Yes |
| MariaDB | Yes |
| PostgreDB | Yes |
| H2 | Yes |
| Mongo | Yes |
| Redis | Yes |
| Oracle | Under Development |
| SqlServer | Under Development |
| GuassDB | Under Development |
| Dameng | Under Development |
| DB2 | Under Development |
| PrestoSQL | Under Development |
| Trino | Under Development |
| Nebula | Under Development |
| Tidb | Under Development |
| ES | Under Development |
| Kafka | Under Development |
Data Source Syntax Support
Mysql
MySQL supports querying using SQL (Structured Query Language), which is the standard language for performing database operations. It is typically divided into three categories: DDL, DML, and queries. MySQL also includes some other statement categories, such as replication. For the components of SQL syntax, please refer to: Mysql SQL Official Documentation.
- DDL (Data Definition Language) Used to define database objects such as databases, tables, views, and indexes. Common DDL statements are:
CREATE: Create database, table, and other objects.sqlCREATE DATABASE test_db; CREATE TABLE users (id INT, name VARCHAR(50));ALTER: Modify the structure of database, table, and other objects.sqlALTER TABLE users ADD COLUMN age INT;DROP: Delete database, table, and other objects.sqlDROP TABLE users;
- DML (Data Manipulation Language) Used to perform insert, delete, and update operations on data in the database. Common DML statements are:
INSERT: Insert data into a table.sqlINSERT INTO users (id, name, age) VALUES (1, 'Alice', 25);UPDATE: Modify data in a table.sqlUPDATE users SET age = 26 WHERE id = 1;DELETE: Delete data from a table.sqlDELETE FROM users WHERE id = 1;
- Query Statements Used to retrieve data from the database. Common query statements are:
SELECT: Basic query statement.sqlSELECT * FROM users;- Conditional Query: Use the
WHEREclause to filter data.sqlSELECT * FROM users WHERE age > 20; - Sorting Query: Use the
ORDER BYclause to sort the results.sqlSELECT * FROM users ORDER BY age DESC;
- Replication-Related Statements Replication in MySQL is used to achieve data backup and read - write separation. Common replication - related statements are:
CHANGE MASTER TO: Configure master - slave replication parameters.sqlCHANGE MASTER TO MASTER_HOST='master_host', MASTER_USER='replication_user', MASTER_PASSWORD='password';START SLAVE: Start the slave server replication process.sqlSTART SLAVE;
MariaDB
Same as MySQL
Redis
Redis uses the Lua language as its script execution environment. This design allows users to perform complex multi-command operations on the Redis server while ensuring atomic execution. The application of Lua scripts in Redis provides powerful data processing capabilities while maintaining high-efficiency execution.
Basic Syntax Structure Lua scripts in Redis follow the standard Lua syntax but add some Redis-specific functions:
Example 1: Calculate the sum of two keys
-- Example script: Calculate the sum of two keys
local key1 = KEYS[1]
local key2 = KEYS[2]
local val1 = redis.call('GET', key1)
local val2 = redis.call('GET', key2)
return val1 + val2Example 2: Implement counter functionality
-- Example script: Implement counter functionality
local key = KEYS[1]
local increment = tonumber(ARGV[1]) or 1
local current = tonumber(redis.call('GET', key) or '0')
local result = current + increment
redis.call('SET', key, result)
return resultExample 3: Batch set multiple key-value pairs
-- Example script: Batch set multiple key-value pairs
for i = 1, #KEYS, 2 do
local key = KEYS[i]
local value = KEYS[i+1]
redis.call('SET', key, value)
end
return #KEYS / 2Redis Lua Script Official Documentation
Redis's Lua script functionality provides a powerful tool for complex data operations while maintaining Redis's concise and efficient design philosophy.
MongoDB
MongoDB uses JavaScript as its query language, providing powerful scripting capabilities. The MongoDB Shell is an interactive JavaScript environment that allows users to perform various database operations.
Basic Query Syntax
1. Simple Query
// Find all documents
db.collection.find()
// Find documents with specific field matching
db.collection.find({ field: "value" })2. Conditional Query
// Find documents with age greater than 18
db.collection.find({ age: { $gt: 18 } })
// Find documents with age greater than or equal to 18 and less than 30
db.collection.find({ age: { $gte: 18, $lt: 30 } })
// Find documents with name equal to Alice or Bob
db.collection.find({ name: { $in: ["Alice", "Bob"] } })3. Projection Query
// Only return the name field, not the _id field
db.collection.find({}, { name: 1, _id: 0 })
// Return name and age fields, not the _id field
db.collection.find({}, { name: 1, age: 1, _id: 0 })4. Sort Query
// Sort by age field in ascending order
db.collection.find().sort({ age: 1 })
// Sort by age field in descending order
db.collection.find().sort({ age: -1 })5. Limit Query Results
// Only return the first 5 documents
db.collection.find().limit(5)
// Skip the first 5 documents and return the next 10 documents
db.collection.find().skip(5).limit(10)6. Aggregation Query
// Group by age field and count the number of documents for each age
db.collection.aggregate([
{ $group: { _id: "$age", count: { $sum: 1 } } }
])
// Calculate the average age of all documents
db.collection.aggregate([
{ $group: { _id: null, avgAge: { $avg: "$age" } } }
])H2
H2 is a lightweight open-source embedded relational database written in Java, supporting both in-memory and persistent modes, and providing standard SQL syntax support.
Basic SQL Examples:
-- Create table
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));
-- Insert data
INSERT INTO users VALUES (1, 'Alice');
-- Query data
SELECT * FROM users;Connection Methods:
- In-memory mode:
jdbc:h2:mem:test - Persistent mode:
jdbc:h2:~/test - Server mode:
jdbc:h2:tcp://localhost/~/test