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

Derive schema by sampling database #6

Merged
merged 16 commits into from
Mar 19, 2024
Merged

Derive schema by sampling database #6

merged 16 commits into from
Mar 19, 2024

Conversation

dmoverton
Copy link
Contributor

@dmoverton dmoverton commented Mar 18, 2024

Describe your changes

Create a schema from a sample of documents.

Example command:

hasura-mongodb --connection-uri mongodb://localhost:27017/db --context-path ./config update --sample-size 100

will sample 100 documents from each collection in the database db and write the resulting schema to ./config/schema.json.

Issue ticket number and link

https://hasurahq.atlassian.net/browse/MDB-83

Type

(Select only one. In case of multiple, choose the most appropriate)

  • highlight
  • enhancement
  • bugfix
  • behaviour-change
  • performance-enhancement
  • security-fix

@dmoverton dmoverton marked this pull request as draft March 18, 2024 11:56
@dmoverton dmoverton self-assigned this Mar 19, 2024
@dmoverton dmoverton requested a review from hallettj March 19, 2024 07:06
@dmoverton dmoverton changed the title Dmoverton/sampling Derive schema by sampling database Mar 19, 2024
@dmoverton dmoverton marked this pull request as ready for review March 19, 2024 07:08
Copy link
Collaborator

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

Works great! I tested nullability detection via type unification, and I like it!

Comment on lines +4 to +10
pub fn align_with_result<K, T, U, V, E, FT, FU, FTU>(ts: IndexMap<K, T>, mut us: IndexMap<K, U>, ft: FT, fu: FU, ftu: FTU) -> Result<IndexMap<K, V>, E>
where
K: Hash + Eq,
FT: Fn(T) -> Result<V, E>,
FU: Fn(U) -> Result<V, E>,
FTU: Fn(T, U) -> Result<V, E>,
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@dmoverton dmoverton merged commit e7c8f79 into main Mar 19, 2024
2 checks passed
@dmoverton dmoverton deleted the dmoverton/sampling branch March 19, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants