Google BigQuery doesn't support UUID as data type. So, which option is better to store it:
STRING
: String with the format 8-4-4-4-12BYTES
: Array of 16 bytes (128 bits)Description. Returns a random universally unique identifier (UUID) as a STRING . The returned STRING consists of 32 hexadecimal digits in five groups separated by hyphens in the form 8-4-4-4-12. The hexadecimal digits represent 122 random bits and 6 fixed bits, in compliance with RFC 4122 section 4.4.
A BigQuery job can create the destination table if not exist. But to create dynamic tables you'll need to give the destination table a different name every day. Or you can use the partitioned tables, then the destination table name can remain the same, and a new partition will be automatically created every day.
Edit: BigQuery now supports a function called GENERATE_UUID
. This returns a STRING
with 32 hexadecimal digits in five groups separated by hyphens in the form 8-4-4-4-12.
Original content:
Some discussion of the tradeoffs:
STRING
BYTES
later, you can potentially convert using a UDF.BYTES
depending on the operator, since string comparisons have to take UTF-8 encoding into account. (It sounds like this isn't an issue for you).BYTES
STRING
s later, you can potentially convert them using a UDF.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