Open n00bik opened 5 years ago
Rewrite prepare/execute to simple fetchColumn wihtout limit 1
if ($conn->fetchColumn("SELECT order_id FROM payments WHERE order_id='{$order_id}' AND appid='{$j->app_id}'")) { file_put_contents('ch_dupl_' . date('Y-m-d') . '_' . $tbl . '_' . $j->app_id . '_' . uniqid() . '.json', json_encode($j)); return true; }
error log is the same=
An exception occurred while executing 'SELECT order_id FROM payments WHERE order_id='xxx' AND appid='yyy'':\n\nCan`t find meta"
Thank you in advance!
I also have this error.
$stmt = $conn->prepare('SELECT COUNT(*) FROM user_view WHERE view_date BETWEEN :dateBegin AND :dateEnd');
$stmt->bindValue('dateBegin', $start->format("Y-m-d"));
$stmt->bindValue('dateEnd', $end->format("Y-m-d"));
$stmt->execute();
An exception occurred while executing 'SELECT COUNT(*) FROM user_view WHERE view_date BETWEEN :dateBegin AND :dateEnd' with params ["2019-05-01", "2019-05-31"]:
Can`t find meta
I'm running into the same "Can`t find meta" error, using a CTE.
This is caused by the following code in ClickHouseStatement.processViaSMI2
:
$this->rows =
stripos($sql, 'select') === 0 ||
stripos($sql, 'show') === 0 ||
stripos($sql, 'describe') === 0 ?
$this->smi2CHClient->select($sql)->rows() :
$this->smi2CHClient->write($sql)->rows();
The statement must begin with select to use the appropriate methods. Maybe your query is not starting with SELECT (but has some weird whitespace or something?) @n00bik and @Sufir ?
I've made a fork that quickfixes this issue for CTE's: https://github.com/easyterrabv/dbal-clickhouse/commit/19b0695e05f1abab5f958692f047bbe0dceabd1e
Hello.
I try to check if records already exist, and get error = "An exception occurred while executing 'SELECT 1 dupl FROM payments WHERE order_id= :order_id AND appid= :appid LIMIT 1' with params [\"xxx=:1:11\", \"yyy-Amazon\"]:\n\nCan`t find meta"}
My code:
$stmt = $conn->prepare('SELECT 1 dupl FROM payments WHERE order_id= :order_id AND appid= :appid LIMIT 1'); $stmt->bindValue('order_id', $order_id); $stmt->bindValue('appid', $j->app_id); $stmt->execute(); while ($row = $stmt->fetch()) { file_put_contents('ch_dupl_' . date('Y-m-d') . '_' . $tbl . '_' . $j->app_id . '_' . uniqid() . '.json', json_encode($j)); return true; }
My table structure:
CREATE TABLE default.payments ( cohort Date, installdatetime DateTime, attributedtouchtime Nullable(DateTime), ... appid String, ... order_id String, ... ) ENGINE = MergeTree() PARTITION BY cohort ORDER BY appid SETTINGS index_granularity = 8192;