Comments (1)
Actually disabling foreign_key_checks is also what the C-based mysqldump script (the one that ships with MySQL) does too. Looking at its source, its not able to do anything else than disable foreign key constraints.
Outside of disabling key constraints, the other and only option (that leads to somewhat might-break-at-any-second low-level code) is ordering all statements according to constraints, which I'm not sure if it's even fully possible (its for normal table references). This means that inserts, trigger/table/view/event creations and trigger/table/view/event drops will be all in mixed order. I'm not aware any project that actually even does this.
The only way of getting table constraint referencing order is by reading INFORMATION_SCHEMA.KEY_COLUMN_USAGE and writing a custom sorter handler that returns tables in constraint order. MySQL doesn't have its own extension for accessing key constraints (Danpu uses those documented SHOW extensions, which means simpler code and b/f compatibility, albeit if we wanted to support anything non-MySQL like we would have to access schema tables directly... and handle with vendor inconstancies).
As ordering goes, Danpu has same issues as the official mysqldump script. While both allow importing over existing databases, neither should if the database contains anything other than tables or views. Neither drops events/triggers before inserting rows, leading into duplicate data and/or error. Then again, it can be used as a feature.
We'll have to change the defaults for 3.0.0 release, and correct some of the logic for 2.7.0 (move trigger/event dropping to the top and add support for drop table -- as its new feature might as well change the create table if exits to drop-and-create as with tables/views/triggers/events -- offers some consistency too).
from danpu.
Related Issues (20)
- Add --single-transaction HOT 1
- How to correctly check if dump/restore went successful? HOT 2
- add include-tables config option
- Add bzip2 compression HOT 3
- Add drop-database statement HOT 2
- Update README to include config options HOT 4
- Remove cache file if backup returns an error HOT 4
- Capability of change db name when exporting HOT 2
- other adapters?
- create database if not exists?
- bringing over database with data hangs
- Cannot add foreign key constraing HOT 2
- exporting/importing takes longer the mysqldump HOT 2
- Existing tables not being imported are not dropped.
- read and write permission HOT 1
- Add transactions to import?
- Add mysql port support HOT 2
- Avoid heavy work in constructor
- rename Permission denied,How can I resolve it in Linux ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from danpu.