Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Add ability to pass args to command warden db connect and import #22

Closed
adexandros opened this issue Oct 17, 2019 · 2 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@adexandros
Copy link

Since we added the ability to have split databases or have multiple ones on the same project for various reason, would be useful to pass the service name to the import/connect command in order to select the destination database

@davidalger davidalger added the enhancement New feature or request label Oct 25, 2019
@davidalger
Copy link
Collaborator

I'm not sure exactly when this was addressed TBH, but it was at some point as it is possible with Warden 0.5.3 to pass arguments to db sub-commands:

$ warden db connect -e 'show databases;'
+--------------------+
| Database           |
+--------------------+
| information_schema |
| magento            |
+--------------------+

davidalger added a commit that referenced this issue Jun 29, 2020
…ss arguments to 'db import'

Related to #22

Example usage:

$ warden db connect -e 'select * from theme' --skip-column-names -A

OR

$ warden db import -A --init-command="SET SESSION FOREIGN_KEY_CHECKS=0;"
@davidalger davidalger added this to the Warden 0.6.0 milestone Jun 29, 2020
@davidalger
Copy link
Collaborator

Actually my bad, this hadn't been implemented, just partially so (you could pass args to db connect, but you could not pass them to db import and you certainly could not override the db name). It has been addressed in a556fd7. All of the following scenarios function:

davidalger:03:50 PM:~/sites/sh6$ echo "SELECT @@FOREIGN_KEY_CHECKS;" | warden db import -A
@@FOREIGN_KEY_CHECKS
1
davidalger:03:51 PM:~/sites/sh6$ echo "SELECT @@FOREIGN_KEY_CHECKS;" | warden db import -A --init-command="SET SESSION FOREIGN_KEY_CHECKS=0;"
@@FOREIGN_KEY_CHECKS
0
davidalger:03:51 PM:~/sites/sh6$ warden db connect -A -e 'show databases'
+--------------------+
| Database           |
+--------------------+
| information_schema |
| shopware           |
| shopware_e2e       |
| shopware_test      |
+--------------------+
davidalger:03:51 PM:~/sites/sh6$ warden db connect -A shopware_test
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.4.13-MariaDB-1:10.4.13+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [shopware_test]> Bye
davidalger:03:51 PM:~/sites/sh6$ warden db connect
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 10.4.13-MariaDB-1:10.4.13+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [shopware]> Bye
davidalger:03:51 PM:~/sites/sh6$ warden db connect shopware_e2e
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.4.13-MariaDB-1:10.4.13+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [shopware_e2e]> Bye

davidalger added a commit that referenced this issue Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants