-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.triage meI really want to be triaged.I really want to be triaged.
Description
Is your feature request related to a problem? Please describe.
I'd like InferSchema to set defaults for columns.
Describe the solution you'd like
Add default= as an option for the bigquery tag. For example:
type withDefaults struct {
Bytes []byte `bigquery:",nullable,default=b'hey now'"`
Rat *big.Rat `bigquery:",nullable,default=3.1415"`
RequiredBytes []byte `bigquery:",default=b'hey now'"`
RequiredRat *big.Rat `bigquery:",default=3.1415"`
NullInt64 NullInt64 `bigquery:",default=77"`
NullFloat64 NullFloat64 `bigquery:",default=77.24"`
NullBool NullBool `bigquery:",default=false"`
NullString NullString `bigquery:",default='hey now'"`
NullJSON NullJSON `bigquery:",default='{}'"`
NullTimestamp NullTimestamp `bigquery:",default=CURRENT_TIMESTAMP()"`
NullDate NullDate `bigquery:",default=CURRENT_DATE()"`
NullTime NullTime `bigquery:",default=CURRENT_TIME()"`
NullDateTime NullDateTime `bigquery:",default=CURRENT_DATETIME()"`
GoTime time.Time `bigquery:",default=CURRENT_DATETIME()"`
Time civil.Time `bigquery:",default=CURRENT_TIME()"`
Date civil.Date `bigquery:",default=CURRENT_DATE()"`
DateTime civil.DateTime `bigquery:",default=CURRENT_DATETIME()"`
String string `bigquery:",default='hey now'"`
Bool bool `bigquery:",default=true"`
Float32 float32 `bigquery:",default=3.14"`
Float64 float64 `bigquery:",default=3.1415"`
Int32 int32 `bigquery:",default=77"`
Int64 int64 `bigquery:",default=7777"`
}Describe alternatives you've considered
When creating tables
- Modify columns in the schema returned from
InferSchema - Execute an
ALTER TABLE ALTER COLUMNstatement to set the default
Both of those alternatives require extra code with the drawbacks
- Table creation wouldn't be atomic
- It would be necessary to keep extra code in sync with the table described in the structure, which is brittle
Additional context
No.
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.triage meI really want to be triaged.I really want to be triaged.