Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
3bb1fa4e
Commit
3bb1fa4e
authored
9 years ago
by
Cam Saül
Browse files
Options
Downloads
Patches
Plain Diff
"nested fields" not "subfields"
parent
1c5f1a4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/driver/interface.clj
+2
-2
2 additions, 2 deletions
src/metabase/driver/interface.clj
src/metabase/driver/mongo.clj
+3
-3
3 additions, 3 deletions
src/metabase/driver/mongo.clj
src/metabase/driver/sync.clj
+9
-6
9 additions, 6 deletions
src/metabase/driver/sync.clj
with
14 additions
and
11 deletions
src/metabase/driver/interface.clj
+
2
−
2
View file @
3bb1fa4e
...
...
@@ -70,10 +70,10 @@
* dest-column-name"
))
(
defprotocol
ISyncDriverField
Sub
Fields
(
defprotocol
ISyncDriverField
Nested
Fields
"Optional protocol that should provide information about the subfields of a FIELD when applicable.
Drivers that declare support for `:nested-fields` should implement this protocol."
(
active-
sub
field-name
s
->type
[
this
field
]
(
active-
nested-
field-name->type
[
this
field
]
"Return a map of string names of active child `Fields` of FIELD -> `Field.base_type`."
))
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/mongo.clj
+
3
−
3
View file @
3bb1fa4e
...
...
@@ -97,8 +97,8 @@
(
mq/with-collection
conn
(
:name
table
)
(
mq/fields
[(
:name
field
)])))))))
ISyncDriverField
Sub
Fields
(
active-
sub
field-name
s
->type
[
this
field
]
ISyncDriverField
Nested
Fields
(
active-
nested-
field-name->type
[
this
field
]
;; Build a map of nested-field-key -> type -> count
;; TODO - using an atom isn't the *fastest* thing in the world (but is the easiest); consider alternate implementation
(
let
[
field->type->count
(
atom
{})]
...
...
@@ -150,7 +150,7 @@
(
datasets/with-dataset
:mongo
(
data/with-temp-db
[
db
(
data/dataset-loader
)
defs/geographical-tips
]
(
with-mongo-connection
[
_
db
]
(
active-
sub
field-name
s
->type
driver
&
tips.venue
)))))
(
active-
nested-
field-name->type
driver
&
tips.venue
)))))
;; TODO
;; 1. Sync
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/sync.clj
+
9
−
6
View file @
3bb1fa4e
...
...
@@ -24,7 +24,7 @@
sync-table-active-fields-and-pks!
sync-table-fks!
sync-table-fields-metadata!
sync-field-
sub
fields!
sync-field-
nested-
fields!
update-table-row-count!
)
;; ## sync-database! and sync-table!
...
...
@@ -252,7 +252,7 @@
mark-category-field!
(
mark-no-preview-display-field!
driver
)
auto-assign-field-special-type-by-name!
(
sync-field-
sub
fields!
driver
)))
(
sync-field-
nested-
fields!
driver
)))
;; Each field-syncing function below should return FIELD with any updates that we made, or nil.
...
...
@@ -429,9 +429,12 @@
(
assoc
field
:special_type
special-type
))))
(
defn-
sync-field-
sub
fields!
[
driver
field
]
(
defn-
sync-field-
nested-
fields!
[
driver
field
]
(
when
(
and
(
=
(
:base_type
field
)
:DictionaryField
)
(
supports?
driver
:nested-fields
)
; if one of these is true
(
satisfies?
ISyncDriverFieldSubFields
driver
))
; the other should be :wink:
(
let
[
subfield-name->type
(
active-subfield-names->type
driver
field
)]
(
log/info
(
u/format-color
'green
"Syncing subfields for '%s.%s': %s"
(
:name
@
(
:table
field
))
(
:name
field
)
(
keys
subfield-name->type
))))))
(
satisfies?
ISyncDriverFieldNestedFields
driver
))
; the other should be :wink:
(
let
[
nested-field-name->type
(
active-nested-field-name->type
driver
field
)]
(
log/info
(
u/format-color
'green
"Syncing subfields for '%s.%s': %s"
(
:name
@
(
:table
field
))
(
:name
field
)
(
keys
nested-field-name->type
)))
;; fetch those existing nested fields
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment