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

27: Add object count #115

Merged
merged 2 commits into from
Oct 26, 2023
Merged

27: Add object count #115

merged 2 commits into from
Oct 26, 2023

Conversation

bobbyiliev
Copy link
Contributor

Adding an object count to the Schema Explorer section which will show a count of all objects:

image

Also fixes a small bug where the getSources method was selecting from the mz_sinks table resulting in always 0 sources.

Closes #27

@bobbyiliev bobbyiliev requested a review from joacoc October 26, 2023 14:22
Copy link
Contributor

@joacoc joacoc left a comment

Choose a reason for hiding this comment

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

I'm still impressed with how fast you nailed it. Only left a comment about performance/async promises.

@@ -52,14 +52,21 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod
console.log("SchemaReader: ", schema, schemas, schemaName);

if (schema) {
const sourceCount = await this.getSources(schema.id).then(s => s.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if, instead of using multiple await statements for individual queries, we use a single query to retrieve all the counts, or put all the promises in one array and execute them in parallel?

E.g.:

const promises = [];
promises.push(this.getSources(schema.id).then(s => s.length));
...

const [sourceCount, ...] = await Promise.all(promises);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Just refactored this as requested.

@bobbyiliev bobbyiliev merged commit 01b0d8f into main Oct 26, 2023
1 check passed
@bobbyiliev bobbyiliev deleted the 27-object-count branch October 26, 2023 16:19
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.

Schema Explorer should expose the object count
2 participants