Request a demo

BigQuery reference

BigQuery hash and utility functions

Hashing, unique IDs and a few utility functions that show up in pipelines: deterministic sampling, surrogate keys, deduplication and raising your own errors.

Functions in this category

FunctionWhat it does
ERRORERROR(message) stops the query with your own error message.
FARM_FINGERPRINTFARM_FINGERPRINT(value) hashes a STRING or BYTES value to a signed INT64 that never changes between runs.
GENERATE_UUIDGENERATE_UUID() returns a random version 4 UUID as a lowercase 36-character STRING, such as 3f2b8c1e-9d4a-4e7b-8c21-5a6f0d9e7b13.
MD5MD5(input) returns the 16-byte MD5 hash of a STRING or BYTES value as BYTES, which the console shows in base64.
SESSION_USERSESSION_USER() returns the email address of the user or service account running the query, or a principal identifier for third-party identities.
SHA256SHA256(input) returns the 32-byte SHA-256 hash of a STRING or BYTES value as BYTES.

More of the BigQuery reference

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.