如何在crontab中运行BQ命令

时间:2018-05-21 06:56:14

标签: cron google-bigquery

我尝试使用BQ命令行将CSV文件导入Bigquery,它将在bash脚本中正常运行。当我尝试使用crontab运行此脚本时,我有错误消息“bq:command not found”

这是我的剧本

public function up()
{
    Schema::create('contents_categories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->string('lang',2)->default('fa');
        $table->integer('parent')->default(0);
        $table->timestamps();
    });
}

当我从shell运行时,此脚本正常工作。

这是cron的工作

#!/bin/bash
bq load --field_delimiter=";" --source_format=CSV.....

为什么它不能用于crontab?

1 个答案:

答案 0 :(得分:0)

您的../google-cloud-sdk/bin变量必须描述包含程序的目录,而不是单个程序的路径。

在这种情况下,它应该是../google-cloud-sdk/bin/bq而不是from operator import mul from functools import reduce # no need for this in Python 2.x res = [reduce(mul, i) for i in zip(*A)]

相关问题