When running the below SELECT I get this error message
Error: Invalid field name "_PARTITIONTIME". Field names are not allowed to start with the (case-insensitive) prefixes _PARTITION, TABLE, FILE and _ROW_TIMESTAMP
SELECT
_PARTITIONTIME,
jobId
FROM
`project.dataset.audit`
WHERE
_PARTITIONTIME >= TIMESTAMP("2019-02-20")
However, when I use it in a DML the query is working
INSERT INTO
`project.dataset.audit_clustered`
(
_PARTITIONTIME,
jobId,
)
SELECT
_PARTITIONTIME,
jobId
FROM
`project.dataset.audit`
WHERE
_PARTITIONTIME >= TIMESTAMP("2019-02-20")
I have 2 questions:
SELECT alone is not workingINSERT will work properly and data will be inserted to the correct partition of the target tableReplace
SELECT _PARTITIONTIME
With
SELECT _PARTITIONTIME AS something
This because the resulting set can't have a column starting with _, but you can name it anything else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With