fulfillment/periscope-to-mysql

将 Periscope SQL 转换为 MySQL 语句。

0.0.2 2016-03-11 23:01 UTC

This package is not auto-updated.

Last update: 2024-09-11 23:56:09 UTC


README

periscopedata.com 是一个强大的工具,用于生成报告,但有时我想要将我在 Periscope 中写的内容用于其他地方。此包允许您在 PHP 中编写一次,但可以生成具有过滤器、日期范围等 MySQL 语句。

限制

当然...

  • 假设您的数据库使用 UTC
  • 总是转换为 EST
  • 不知道外键 = 无法自动连接表

示例

use Fulfillment\periscopeToMySQL\periscopeToMySQL;

$args = [
    'dateStart' => "2016-01-01",
    'dateEnd'   => "2016-03-11",
    'Warehouse' => "1,2,3",
    'State'     => "GA",
];

$sql = 'SELECT
            [yourFirstTable.aDate:est] AS aDate,
            yourSecondTable.part2
        FROM
            yourFirstTable
            JOIN yourSecondTable ON yourFirstTable.id = yourSecondTable.id
        WHERE
            [yourFirstTable.recordedOn=daterange:est]
            AND [yourFirstTable.warehouse=Warehouse]
            AND [yourSecondTable.state=State]';

$sql = periscopeToMySQL::fillTemplate($sql, $args);

安装

警告:该项目仍在开发中

Composer

composer require fulfillment/periscope-to-mysql
"require": {
    "fulfillment/periscope-to-mysql": "dev-master"
}

本地

"repositories": [
    {
        "type": "path",
        "url": "../periscope-to-mysql"
    }
],
"require": {
    "fulfillment/periscope-to-mysql": "dev-master"
}

贡献

请随意,时区支持可能是一个好的开始。