Skip to content

Commit

Permalink
Use JsonEachRow format in ShowCreateTable
Browse files Browse the repository at this point in the history
\n"s were escaped with TabSeparated
  • Loading branch information
simPod committed Aug 12, 2020
1 parent 88f0d9a commit d52632c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Snippet/ShowCreateTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
namespace SimPod\ClickHouseClient\Snippet;

use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\TabSeparated;
use SimPod\ClickHouseClient\Format\JsonEachRow;
use Webmozart\Assert\Assert;
use function trim;

final class ShowCreateTable
Expand All @@ -16,9 +17,12 @@ public static function run(ClickHouseClient $clickHouseClient, string $tableName
<<<CLICKHOUSE
SHOW CREATE TABLE $tableName
CLICKHOUSE,
new TabSeparated()
new JsonEachRow()
);

return trim($output->contents);
$statement = $output->data[0]['statement'];
Assert::string($statement);

return trim($statement);
}
}

0 comments on commit d52632c

Please sign in to comment.