{"record":{"id":"ed850ac464923efa","repo":"getredash/redash","slug":"unknown-date-time-format-in-results-ed850a","errorCode":null,"errorMessage":"Unknown date/time format in results: '{}'","messagePattern":"Unknown date/time format in results: '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"redash/query_runner/google_search_console.py","lineNumber":89,"sourceCode":"                value = get_formatted_value(column_type, value)\n                d[column_name] = value\n        rows.append(d)\n\n    return {\"columns\": columns, \"rows\": rows}\n\n\ndef get_formatted_value(column_type, value):\n    if column_type == \"number\":\n        value = round(value, 2)\n    elif column_type == TYPE_DATE:\n        value = datetime.strptime(value, \"%Y-%m-%d\")\n    elif column_type == TYPE_DATETIME:\n        if len(value) == 10:\n            value = datetime.strptime(value, \"%Y%m%d%H\")\n        elif len(value) == 12:\n            value = datetime.strptime(value, \"%Y%m%d%H%M\")\n        else:\n            raise Exception(\"Unknown date/time format in results: '{}'\".format(value))\n    return value\n\n\nclass GoogleSearchConsole(BaseSQLQueryRunner):\n    should_annotate_query = False\n\n    @classmethod\n    def type(cls):\n        return \"google_search_console\"\n\n    @classmethod\n    def name(cls):\n        return \"Google Search Console\"\n\n    @classmethod\n    def enabled(cls):\n        return enabled\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/google_search_console.py#L71-L107","documentation":"Google Search Console runner's get_formatted_value applies the same compact-datetime rule: only lengths 10 (YYYYMMDDHH) and 12 (YYYYMMDDHHMM) parse for TYPE_DATETIME; anything else raises 'Unknown date/time format in results'.","triggerScenarios":"A Search Console dimension inferred as datetime whose value length is not 10 or 12 — e.g. the 'date' dimension returns 'YYYYMMDD' (8 chars) but the column type was set to TYPE_DATETIME in query results column hints.","commonSituations":"Declaring the date column as datetime in the query's columns metadata while the API supplies 8-char dates; GSC API format changes.","solutions":["Set the column type to date (TYPE_DATE) or string instead of datetime for the date dimension","Use a dimension whose value length is 10 or 12 if you truly need datetime","Upgrade Redash for improved format handling"],"exampleFix":"// before\n{\"columns\": [{\"name\": \"date\", \"type\": \"datetime\"}]}\n// after\n{\"columns\": [{\"name\": \"date\", \"type\": \"date\"}]}","handlingStrategy":"validation","validationCode":"import re\n\ndef gsc_datetime_ok(v) -> bool:\n    return isinstance(v, str) and bool(re.fullmatch(r\"\\d{10}|\\d{12}\", v))","typeGuard":null,"tryCatchPattern":"try:\n    data = runner.run_query(q, user)\nexcept Exception as e:\n    if \"Unknown date/time format\" in str(e):\n        set_date_column_type_to_date_and_rerun()","preventionTips":["Declare GSC 'date' as date, not datetime","Match column type to actual value granularity","Test small date ranges first"],"tags":["google-search-console","date-parsing","datetime"],"backgroundTag":"date-parse-failure","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}