evidence-dev / sqltools-bigquery-driver

Query and Explore BigQuery from VSCode
https://marketplace.visualstudio.com/items?itemName=Evidence.sqltools-bigquery-driver
MIT License
40 stars 5 forks source link

Add sorting to fetchDatabases and fetchSchemas functions #22

Closed dmytro-lytvyn closed 2 months ago

dmytro-lytvyn commented 3 months ago

This PR adds sorting to the list of databases and schemas (datasets), as described in the issue https://github.com/evidence-dev/sqltools-bigquery-driver/issues/21

dmytro-lytvyn commented 2 months ago

Hi @archiewood could you please have a look at this PR?

archiewood commented 2 months ago

This looks sensible enough, will try to test and release later in the week.

Feel free to bug me about this.

dmytro-lytvyn commented 2 months ago

Hi @archiewood did you have a chance to test this? 🙏 We have around 60 datasets in one project (bad design, to be changed soon I hope) and they are very hard to navigate from VSCode with SQLTools because of random order 😅

archiewood commented 2 months ago

Thanks for the reminder, this works great!

archiewood commented 2 months ago

released in v0.0.7

https://marketplace.visualstudio.com/items?itemName=Evidence.sqltools-bigquery-driver

dmytro-lytvyn commented 2 months ago

I'm confused, when I'm debugging this change locally in VSCode it works, and yet when I update or fully reinstall the extension v0.0.7 from the marketplace, it still doesn't sort the schemas 😞 Could it be that this change was not included in the build somehow @archiewood ? 🤔

dmytro-lytvyn commented 2 months ago

Yup, confirmed - it's included in the source code, but not inside the unzipped sqltools-bigquery-driver-0.0.7.vsix file (/extension/out/ls/queries.js):

const fetchSchemas = (0, factory_1.default) `
  SELECT
    schema_name as label,
    schema_name as schema,
    '${types_1.ContextValue.SCHEMA}' as type,
    'schema' as detail,
    'group-by-ref-type' as iconId
  FROM INFORMATION_SCHEMA.SCHEMATA
`;
const fetchDatabases = (0, factory_1.default) `
  SELECT
    catalog_name as label,
    catalog_name as database,
    '${types_1.ContextValue.DATABASE}' as type,
    'database' as detail
  FROM INFORMATION_SCHEMA.SCHEMATA
  GROUP BY catalog_name
`;

Maybe you uploaded the wrong artifact by mistake?

archiewood commented 2 months ago

Thanks for flagging

I'll take a look at this next week

dmytro-lytvyn commented 2 months ago

Hi @archiewood sorry for bothering you, just a reminder to re-upload the artifact for v0.0.7 😊

archiewood commented 2 months ago

I've just reuploaded: version is 0.0.8 as you can't reuse version tags!

Confirm sorted tables on my end:

CleanShot 2024-09-17 at 10 29 48

dmytro-lytvyn commented 2 months ago

Confirmed, fixed it on my side too, thanks a lot! ❤️