Skip to content

Commit ffd14bf

Browse files
authored
feat: Add IsPaid flag to table definition (#1327)
This adds an `IsPaid` flag to the table definition. This can be used by premium plugins to indicate that a certain table is paid.
1 parent 023ebbc commit ffd14bf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

schema/arrow.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
MetadataTableDescription = "cq:table_description"
1717
MetadataTableTitle = "cq:table_title"
1818
MetadataTableDependsOn = "cq:table_depends_on"
19+
MetadataTableIsPaid = "cq:table_paid"
1920
)
2021

2122
type Schemas []*arrow.Schema

schema/table.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ type Table struct {
8787
Parent *Table `json:"-"`
8888

8989
PkConstraintName string `json:"pk_constraint_name"`
90+
91+
// IsPaid indicates whether this table is a paid (premium) table.
92+
// This relates to the CloudQuery plugin itself, and should not be confused
93+
// with whether the table makes use of a paid API or not.
94+
IsPaid bool `json:"is_paid"`
9095
}
9196

9297
var (
@@ -158,6 +163,9 @@ func NewTableFromArrowSchema(sc *arrow.Schema) (*Table, error) {
158163
if isIncremental, found := tableMD.GetValue(MetadataIncremental); found {
159164
table.IsIncremental = isIncremental == MetadataTrue
160165
}
166+
if isPaid, found := tableMD.GetValue(MetadataTableIsPaid); found {
167+
table.IsPaid = isPaid == MetadataTrue
168+
}
161169
return table, nil
162170
}
163171

@@ -407,6 +415,9 @@ func (t *Table) ToArrowSchema() *arrow.Schema {
407415
if t.Parent != nil {
408416
md[MetadataTableDependsOn] = t.Parent.Name
409417
}
418+
if t.IsPaid {
419+
md[MetadataTableIsPaid] = MetadataTrue
420+
}
410421
schemaMd := arrow.MetadataFrom(md)
411422
for i, c := range t.Columns {
412423
fields[i] = c.ToArrowField()

0 commit comments

Comments
 (0)