This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
249 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
bin/ | ||
coverage.txt | ||
.idea | ||
var | ||
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
🥟 Dumpling | ||
============ | ||
|
||
[![Build Status](https://travis-ci.org/pingcap/dumpling.svg?branch=master)](https://travis-ci.org/pingcap/dumpling) | ||
[![codecov](https://codecov.io/gh/pingcap/dumpling/branch/master/graph/badge.svg)](https://codecov.io/gh/pingcap/dumpling) | ||
[![API Docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/github.com/pingcap/dumpling) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/pingcap/dumpling)](https://goreportcard.com/report/github.com/pingcap/dumpling) | ||
|
||
**Dumpling** is a tool and a Go library for creating SQL dump from a MySQL-compatible database. | ||
It is intended to replace `mysqldump` and `mydumper` when targeting TiDB. | ||
|
||
You may read the [design document](https://github.com/pingcap/community/blob/master/rfc/2019-12-06-dumpling.md) for details. | ||
|
||
Features | ||
-------- | ||
|
||
> Dumpling is currently in early development stage, and most features are incomplete. Contributions are welcomed! | ||
- [x] SQL dump is split into multiple files (like `mydumper`) for easy management. | ||
- [x] Export multiple tables in parallel to speed up execution. | ||
- [ ] Multiple output formats: SQL, CSV, ... | ||
- [ ] Write to cloud storage (S3, GCS) natively | ||
- [ ] Advanced table filtering via black-/white-lists | ||
|
||
Building | ||
-------- | ||
|
||
1. Install Go 1.13 or above | ||
2. Run `make build` to compile. The output is in `bin/dumpling`. | ||
3. Run `make test` to run the unit tests. | ||
4. Run `make integration_test` to run integration tests. | ||
|
||
License | ||
------- | ||
|
||
Dumpling is under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
if [ -f "$1" ]; then | ||
echo "[$(date)] File $1 already exists." && exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE DATABASE `views` /*!40100 DEFAULT CHARACTER SET latin1 */; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `views`.`v` AS select `views`.`t`.`a` AS `a`,`views`.`t`.`b` AS `b` from `views`.`t`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
run_sql "drop database if exists views" | ||
run_sql "create database views" | ||
export DUMPLING_TEST_DATABASE="views" | ||
|
||
run_sql "create table t (a bigint, b varchar(255))" | ||
run_sql "create definer = 'root'@'localhost' view v as select * from t;" | ||
# insert 20 records to `t`. | ||
i=0; while [ $i -lt 20 ]; do | ||
run_sql "insert into t values ($i, \"$i\")" | ||
i=$(( i + 1 )) | ||
done | ||
|
||
run_dumpling --no-views | ||
file_not_exist "$DUMPLING_OUTPUT_DIR/views.v-schema.sql" | ||
|
||
run_dumpling --no-views=false | ||
diff "$DUMPLING_BASE_NAME/data/views-schema-create.sql" "$DUMPLING_OUTPUT_DIR/views-schema-create.sql" | ||
diff "$DUMPLING_BASE_NAME/data/views.v-schema.sql" "$DUMPLING_OUTPUT_DIR/views.v-schema.sql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.