Skip to content

Commit 635fce5

Browse files
authored
Fixes #6319. Update docs: import SQL dump using sql:connect not sql:cli (#6333)
* Fixes #6319. Update docs: import SQL dump using sql:connect not sql:cli * Add a warning about the slowness * Text
1 parent a511c02 commit 635fce5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Commands/sql/SqlCommands.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ public function drop($options = ['extra' => self::REQ]): void
125125

126126
/**
127127
* Open a SQL command-line interface using Drupal's credentials.
128+
*
129+
* To import an SQL dump, it is more efficient to use sql:connect than sql:cli. See Examples below.
128130
*/
129131
#[CLI\Command(name: self::CLI, aliases: ['sqlc', 'sql-cli'])]
130132
#[CLI\Option(name: 'extra', description: 'Add custom options to the connect string (e.g. --extra=--skip-column-names)')]
@@ -133,12 +135,14 @@ public function drop($options = ['extra' => self::REQ]): void
133135
#[CLI\Topics(topics: [DocsCommands::POLICY])]
134136
#[CLI\Usage(name: 'drush sql:cli', description: 'Open a SQL command-line interface using Drupal\'s credentials.')]
135137
#[CLI\Usage(name: 'drush sql:cli --extra=--progress-reports', description: 'Open a SQL CLI and skip reading table information.')]
136-
#[CLI\Usage(name: 'drush sql:cli < example.sql', description: 'Import sql statements from a file into the current database.')]
138+
#[CLI\Usage(name: '$(drush sql:connect) < example.sql', description: 'Bash: Import SQL statements from a file into the current database.')]
139+
#[CLI\Usage(name: 'eval (drush sql:connect) < example.sql', description: 'Fish: Import SQL statements from a file into the current database.')]
137140
public function cli(InputInterface $input, $options = ['extra' => self::REQ]): void
138141
{
139142
$sql = SqlBase::create($options);
140143
$process = $this->processManager()->shell($sql->connect(), null, $sql->getEnv());
141144
if (!Tty::isTtySupported()) {
145+
$this->logger()->warning('It is slow to pass large amounts of data via stdin to the sql:cli command. See the Examples at https://www.drush.org/latest/commands/sql_cli/ for an alternative using sql:connect.');
142146
$process->setInput($this->stdin()->getStream());
143147
} else {
144148
$process->setTty((bool) $this->getConfig()->get('ssh.tty', $input->isInteractive()));

0 commit comments

Comments
 (0)