datacharmer / test_db

A sample MySQL database with an integrated test suite, used to test your applications and database servers
4.06k stars 2.59k forks source link

Replacing the deprected 'source' in employees.sql #35

Closed boardtc closed 2 years ago

boardtc commented 2 years ago

My understanding is that source has been deprecated for some years.

However, https://github.com/datacharmer/test_db/blob/master/employees.sql includes: SELECT 'LOADING departments' as 'INFO'; source load_departments.dump ;

In Workbench source is underlined in red and gives the error: "source is not valid at this position"

I can run the different dump files individually but these scripts should not include an error/bug.

Is there an alternative to using source,

Bizarrely this was reported over 2 years ago: https://forums.mysql.com/read.php?10,685467,685502

datacharmer commented 2 years ago

Could you provide me with the information about deprecating source? As far as I know, it is still a valid command (https://dev.mysql.com/doc/refman/8.0/en/mysql-batch-commands.html) Sorry about the forums: I don't actively read them, and I was not noticed when the issue was reported.

boardtc commented 2 years ago

Thanks for the reply. Your link indicated it's valid for the command line. I am talking about opening the sql file in the sql editor and executing it there. 'Source' shows as red in the editor, like this Does that make sense?

datacharmer commented 2 years ago

Sorry, I am a command-line guy, and I don't know anything about the SQL editor you mention.If it is a feature of MySQL Workbench, you should ask them. Consider, however, that I am certainly not going to make the test_db unusable from the command line to accommodate the needs of a visual tool. My first consideration is to preserve the usability for early adopter of this database. If exists a solution that works for both tools without data duplication, I am willing to listen.

boardtc commented 2 years ago

Oh, sorry, I opened this in the wrong place, I did not realise, sorry. But are you not providing the .SQL file which is not valid?

datacharmer commented 2 years ago

The SQL file is perfectly valid, when used with the MySQL command line shell. It has been so since 2008 (that's 14 years of compatibility). If MySQL Workbench used to work with it and now it doesn't, it was their decision, which should not affect how other projects work.

boardtc commented 2 years ago

Thanks for taking the time to explain. I opened 108694 but unfortunately, they don't seem to have an active team. I encountered an index out-of-bound bug running the same script file yesterday and this has been in their open bug list since 2019. If they are happy with not fixing index out-of-bound bugs they won't be bothered about supporting the out-of-the-box installation of a sample database recommended in their own documentation.

boardtc commented 2 years ago

To close this out they closed 108694 as a duplicate of 63999 which was opened over 10 years ago.

christianblueskylabs commented 2 years ago

I ended up on this repo from a slow query log article from Google Cloud as seen under Generate sample data with a load test to test if the flags are working.

I'm also encountering the issue explained at hand. I'm running a GCP Cloud SQL on MySQL 8.0.26 and I am unable to just simply load employees.sql.

Appreciate the effort into researching on this, @boardtc. For time-travelers in the future who might read this, simply follow the suggestion on manually loading the dump files in the order they are shown in employees.sql.