cweijan / vscode-database-client

Database Client For Visual Studio Code
https://database-client.com
MIT License
2.48k stars 282 forks source link

Can I dump / export data from multiple selected tables? #993

Closed jjnxpct closed 10 months ago

jjnxpct commented 10 months ago

I would like to create a database dump from multiple tables to one dumpfile. Can I do that? How?

cweijan commented 10 months ago

Hold down ctrl to select the table you want to export, then right-click dump.

jjnxpct commented 10 months ago

When i select multiple tables (using 'ctrl') and then right-click on one of the tables, only the first selected table is exported. Not all selected tables.

The dump file is named after the last selected table, the content of the dump file only contains the structure and data from the first table.

jjnxpct commented 10 months ago

Maybe this output info will help. I selected three tables in the example. axp03_categories + axp03_content_types + axp03_csvi_logs

The result is a file named 'amerong01_db1_axp03_csvi_logs_2023-11-29_152609'. The content of this file is the structure and data of `axp03_categories'.

+++++++++++++

2023-11-29 15:26:12 Executing: C:\Users****.dbclient\dependency\mysql\mysqldump.exe -h 127.0.0.1 -P 11167 -u amerong01_usr1 -p"****" --skip-add-locks --hex-blob amerong01_db1 --skip-triggers axp03_categories axp03_content_types axp03_csvi_logs >"c:\Users****\Desktop\amerong01_db1_axp03_csvi_logs_2023-11-29_152609.sql" 2023-11-29 15:26:13 Executing: C:\Users****.dbclient\dependency\mysql\mysqldump.exe -h 127.0.0.1 -P 11167 -u amerong01_usr1 -p""****"" --skip-add-locks --hex-blob amerong01_db1 --skip-triggers axp03_categories axp03_content_types axp03_csvi_logs >"c:\Users****\Desktop\amerong01_db1_axp03_csvi_logs_2023-11-29_152609.sql" Command failed: C:\Users****.dbclient\dependency\mysql\mysqldump.exe -h 127.0.0.1 -P 11167 -u amerong01_usr1 -p"****" --skip-add-locks --hex-blob amerong01_db1 --skip-triggers axp03_categories axp03_content_types axp03_csvi_logs >"c:\Users****\Desktop\amerong01_db1_axp03_csvi_logs_2023-11-29_152609.sql" mysqldump: [Warning] Using a password on the command line interface can be insecure. mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'amerong01_db1' AND TABLE_NAME = 'axp03_categories';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

cweijan commented 10 months ago

Sorry for the inconvenience. This is because your mysql server version does not match the current mysql_dump version. The extension dump depends on mysql_dump. You need to install the corresponding version of mysql_dump on your computer.

jjnxpct commented 10 months ago

How do install this on my (windows) computer and how do I know what version is needed / will work?

jjnxpct commented 10 months ago

Do I need to install MySQL Community Server? https://dev.mysql.com/downloads/mysql/

cweijan commented 10 months ago

The built-in mysql_dump of the extension is version 8.0. I think your mysql is 5.6 or 5.7. You need to go to https://dev.mysql.com/downloads/installer/ to install the corresponding mysql. And I will fix this in the next version.

MySQL verison: image

cweijan commented 10 months ago

You can try to copy the failed command and add the parameter --column-statistics=0, for example C:\Users*.dbclient\dependency\mysql\mysqldump.exe -h 127.0.0.1 -P 11167 -u amerong01_usr1 -p" " --column-statistics=0 --skip-add-locks --hex-blob amerong01_db1 --skip-triggers axp03_categories axp03_content_types axp03_csvi_logs

cweijan commented 10 months ago

Hi, I have released version 6.8.9 to fix dump failure.

jjnxpct commented 10 months ago

Excellent! Thanks cweijan!