[misc] add table action increase sync.
This commit is contained in:
@@ -195,6 +195,7 @@ class duckdb
|
||||
$sql = preg_replace($ztpattern, $replace, $sql);
|
||||
$sql = preg_replace($ztvpattern, $replace, $sql);
|
||||
|
||||
$sql = str_replace('zt_action.parquet', 'zt_action_*.parquet', $sql);
|
||||
$sql = str_replace('__biPath__', $this->tmpPath, $sql);
|
||||
return $sql;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ $config->bi->conditionList['NOT IN'] = 'NOT IN';
|
||||
$config->bi->conditionList['IS NOT NULL'] = 'IS NOT NULL';
|
||||
$config->bi->conditionList['IS NULL'] = 'IS NULL';
|
||||
|
||||
$config->bi->duckdbExcludeTables = array('metriclib', 'repofiles', 'repohistory', 'queue', 'duckdbqueue', '');
|
||||
$config->bi->duckdbExcludeTables = array('metriclib', 'repofiles', 'repohistory', 'queue', 'duckdbqueue', 'action');
|
||||
|
||||
$config->bi->builtin = new stdclass();
|
||||
$config->bi->builtin->modules = new stdclass();
|
||||
|
||||
@@ -1193,6 +1193,11 @@ class biModel extends model
|
||||
$copySQLs = array();
|
||||
foreach($tables as $table) $copySQLs[] = "copy (select * from {$table}) to '{$duckdbTmpPath}{$table}.parquet'";
|
||||
|
||||
$date = date("Y-m-01 00:00:00");
|
||||
$prefix = $this->config->db->prefix;
|
||||
|
||||
$copySQLs[] = "copy (select * from {$prefix}action where date < TIMESTAMP '$date') to '{$duckdbTmpPath}{$prefix}action_" . date('Y_m', strtotime('-1 month')) . ".parquet'";
|
||||
|
||||
$copySQL = implode(';', $copySQLs);
|
||||
if(empty($copySQL)) return true;
|
||||
|
||||
@@ -1219,6 +1224,9 @@ class biModel extends model
|
||||
$copySQLs = array();
|
||||
foreach($tables as $table) $copySQLs[] = "copy (select * from {$table}) to '{$duckdbTmpPath}{$table}.parquet'";
|
||||
|
||||
$actions = $this->getActionSyncSql();
|
||||
foreach($actions as $table => $sql) $copySQLs[] = "copy ({$sql}) to '{$duckdbTmpPath}{$table}.parquet'";
|
||||
|
||||
$this->biTao->updateSyncTime($tables);
|
||||
|
||||
return implode(';', $copySQLs);
|
||||
|
||||
Reference in New Issue
Block a user