Skip to content

Commit 839468e

Browse files
author
Cary Huang
committed
update
1 parent c7219ad commit 839468e

File tree

2 files changed

+234
-130
lines changed

2 files changed

+234
-130
lines changed

docs/en/getting-started/quick_start.md

Lines changed: 118 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,19 @@ SELECT * FROM synchdb_conninfo;
181181
182182
More details on creating a connector can be found [here](https://docs.synchdb.com/user-guide/create_a_connector/)
183183
184+
## **Create Object Mappings**
185+
186+
By default, source database names will be mapped to a schema name in destination. Object mappings can be used to change this schema name. Let's change the destination schema for `orders` table from oracle based connectors and leave the rest as default.
187+
188+
```sql
189+
SELECT synchdb_add_objmap('oracleconn','table','free.c##dbzuser.orders','oracle23ai.orders');
190+
SELECT synchdb_add_objmap('ora19cconn','table','free.dbzuser.orders','oracle19c.orders');
191+
SELECT synchdb_add_objmap('olrconn','table','free.dbzuser.orders','olr.orders');
192+
193+
```
194+
195+
More details on creating a object mappings can be found [here](https://docs.synchdb.com/user-guide/object_mapping_rules/)
196+
184197
## **Create JMX Exporter - Optional**
185198

186199
Here are some examples to enable JMX exporter for monitoring (If Prometheus + Grafana have been pre-deployed by `ezdeploy.sh`):
@@ -265,6 +278,12 @@ More details on connector start can be found [here](https://docs.synchdb.com/use
265278

266279
Use `synchdb_state_view()` to examine all connectors' running states.
267280
281+
``` SQL
282+
SELECT * FROM synchdb_state_view;
283+
284+
```
285+
286+
Example outputs:
268287
``` SQL
269288
postgres=# SELECT * FROM synchdb_state_view;
270289
name | connector_type | pid | stage | state | err | last_dbz_offset
@@ -286,74 +305,89 @@ By default, the connector will perform a `initial` snapshot to capture both the
286305
287306
**MySQL:**
288307
```sql
289-
postgres=# SET search_path=public,inventory;
290-
SET
291-
postgres=# \d
292-
List of relations
293-
Schema | Name | Type | Owner
294-
-----------+--------------------+----------+--------
295-
inventory | addresses | table | ubuntu
296-
inventory | addresses_id_seq | sequence | ubuntu
297-
inventory | customers | table | ubuntu
298-
inventory | customers_id_seq | sequence | ubuntu
299-
inventory | geom | table | ubuntu
300-
inventory | geom_id_seq | sequence | ubuntu
301-
inventory | perf_test_1 | table | ubuntu
302-
inventory | products | table | ubuntu
303-
inventory | products_id_seq | sequence | ubuntu
304-
inventory | products_on_hand | table | ubuntu
305-
public | synchdb_att_view | view | ubuntu
306-
public | synchdb_attribute | table | ubuntu
307-
public | synchdb_conninfo | table | ubuntu
308-
public | synchdb_objmap | table | ubuntu
309-
public | synchdb_state_view | view | ubuntu
310-
public | synchdb_stats_view | view | ubuntu
311-
(16 rows)
308+
\dt inventory.*
309+
310+
```
311+
312+
```sql
313+
\dt inventory.*
314+
List of relations
315+
Schema | Name | Type | Owner
316+
-----------+------------------+-------+--------
317+
inventory | addresses | table | ubuntu
318+
inventory | customers | table | ubuntu
319+
inventory | geom | table | ubuntu
320+
inventory | orders | table | ubuntu
321+
inventory | products | table | ubuntu
322+
inventory | products_on_hand | table | ubuntu
323+
(6 rows)
312324
```
313325
314326
**Sqlserver:**
315327
```sql
316-
postgres=# SET search_path=public,testdb;
317-
SET
318-
postgres=# \d
319-
List of relations
320-
Schema | Name | Type | Owner
321-
--------+-------------------------+----------+--------
322-
public | synchdb_att_view | view | ubuntu
323-
public | synchdb_attribute | table | ubuntu
324-
public | synchdb_conninfo | table | ubuntu
325-
public | synchdb_objmap | table | ubuntu
326-
public | synchdb_state_view | view | ubuntu
327-
public | synchdb_stats_view | view | ubuntu
328-
testdb | customers | table | ubuntu
329-
testdb | customers_id_seq | sequence | ubuntu
330-
testdb | orders | table | ubuntu
331-
testdb | orders_order_number_seq | sequence | ubuntu
332-
testdb | products | table | ubuntu
333-
testdb | products_id_seq | sequence | ubuntu
334-
testdb | products_on_hand | table | ubuntu
335-
(13 rows)
336-
337-
```
338-
339-
**Oracle23ai, Oracle19c, and OLR:**
340-
```sql
341-
postgres=# SET search_path=public,free;
342-
SET
343-
postgres=# \d
344-
List of relations
345-
Schema | Name | Type | Owner
346-
--------+--------------------+-------+--------
347-
free | orders | table | ubuntu
348-
public | synchdb_att_view | view | ubuntu
349-
public | synchdb_attribute | table | ubuntu
350-
public | synchdb_conninfo | table | ubuntu
351-
public | synchdb_objmap | table | ubuntu
352-
public | synchdb_state_view | view | ubuntu
353-
public | synchdb_stats_view | view | ubuntu
354-
(7 rows)
328+
\dt testdb.*
329+
330+
```
331+
332+
```sql
333+
\dt testdb.*
334+
List of relations
335+
Schema | Name | Type | Owner
336+
--------+------------------+-------+--------
337+
testdb | customers | table | ubuntu
338+
testdb | orders | table | ubuntu
339+
testdb | products | table | ubuntu
340+
testdb | products_on_hand | table | ubuntu
341+
(4 rows)
342+
343+
```
344+
345+
**Oracle23ai**
346+
```sql
347+
\dt oracle23ai.*
348+
349+
```
350+
351+
```sql
352+
\dt oracle23ai.*
353+
List of relations
354+
Schema | Name | Type | Owner
355+
------------+--------+-------+--------
356+
oracle23ai | orders | table | ubuntu
357+
(1 row)
358+
359+
```
360+
361+
**Oracle19c**
362+
```sql
363+
\dt oracle19c.*
364+
365+
```
366+
367+
```sql
368+
\dt oracle19c.*
369+
List of relations
370+
Schema | Name | Type | Owner
371+
-----------+--------+-------+--------
372+
oracle19c | orders | table | ubuntu
373+
(1 row)
374+
```
375+
376+
**OLR**
377+
```sql
378+
\dt olr.*
355379
356380
```
381+
382+
```sql
383+
\dt olr.*
384+
List of relations
385+
Schema | Name | Type | Owner
386+
--------+--------+-------+--------
387+
olr | orders | table | ubuntu
388+
(1 row)
389+
```
390+
357391
## Similate an INSERT Event and Observe CDC
358392
359393
We can use `docker exec` to similate an INSERT for each connector type and observe the Change Data Capture (CDC).
@@ -403,7 +437,26 @@ echo -ne "INSERT INTO orders(order_number, order_date, purchaser, quantity, prod
403437
```
404438
405439
```sql
406-
postgres=# SELECT * FROM free.orders;
440+
postgres=# SELECT * FROM oracle23ai.orders;
441+
order_number | order_date | purchaser | quantity | product_id
442+
--------------+---------------------+-----------+----------+------------
443+
10001 | 2024-01-01 00:00:00 | 1003 | 2 | 107
444+
10002 | 2024-01-01 00:00:00 | 1003 | 2 | 107
445+
10003 | 2024-01-01 00:00:00 | 1003 | 2 | 107
446+
10004 | 2024-01-01 00:00:00 | 1003 | 2 | 107
447+
10005 | 2025-12-12 00:00:00 | 1002 | 10000 | 102
448+
(5 rows)
449+
450+
```
451+
452+
**Oracle19c:**
453+
```bash
454+
echo -ne "INSERT INTO orders(order_number, order_date, purchaser, quantity, product_id) VALUES (10005, TO_DATE('2025-12-12', 'YYYY-MM-DD'), 1002, 10000, 102);\n" | docker exec -i ora19c sqlplus DBZUSER/dbz@//localhost:1521/FREE
455+
456+
```
457+
458+
```sql
459+
postgres=# SELECT * FROM oracle19c.orders;
407460
order_number | order_date | purchaser | quantity | product_id
408461
--------------+---------------------+-----------+----------+------------
409462
10001 | 2024-01-01 00:00:00 | 1003 | 2 | 107
@@ -415,14 +468,14 @@ postgres=# SELECT * FROM free.orders;
415468
416469
```
417470
418-
**Oracle19c and OLR:**
471+
**OLR:**
419472
```bash
420473
echo -ne "INSERT INTO orders(order_number, order_date, purchaser, quantity, product_id) VALUES (10005, TO_DATE('2025-12-12', 'YYYY-MM-DD'), 1002, 10000, 102);\n" | docker exec -i ora19c sqlplus DBZUSER/dbz@//localhost:1521/FREE
421474
422475
```
423476
424477
```sql
425-
postgres=# SELECT * FROM free.orders;
478+
postgres=# SELECT * FROM olr.orders;
426479
order_number | order_date | purchaser | quantity | product_id
427480
--------------+---------------------+-----------+----------+------------
428481
10001 | 2024-01-01 00:00:00 | 1003 | 2 | 107

0 commit comments

Comments
 (0)