Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: load schema for MongoDB data source #714

Merged
merged 2 commits into from
Dec 20, 2015
Merged

Feature: load schema for MongoDB data source #714

merged 2 commits into from
Dec 20, 2015

Conversation

erans
Copy link
Contributor

@erans erans commented Dec 20, 2015

Added schema support for MongoDB. Collections will be shown as tables and we merge the first and last documents (sorted by Natural order) to show the properties of the document. Since MongoDB is document based it might miss a few fields but it should give a good enough reference.

… and we merge the first and last documents (sorted by Natural order) to show the properties of the document. Since MongoDB is document based it might miss a few fields but it should give a good enough reference
def _merge_property_names(self, columns, document):
for property in document:
if property not in columns:
columns.append(property)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return [prop for prop in document if prop not in columns]`

but you can use sets here (which will also be more performant, although it's probably negligible):

set(columns) | set(document.keys()) # or columns can be a set from the get-go.

@arikfr arikfr changed the title added schema support for MongoDB. Collections will be shown as tables… Feature: load schema for MongoDB data source Dec 20, 2015
arikfr added a commit that referenced this pull request Dec 20, 2015
Feature: load schema for MongoDB data source
@arikfr arikfr merged commit cc2dcb2 into getredash:master Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants