-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: show column description in the table schema #79
Conversation
It now showed up when looking at another model. But is now stuck on showing that models schema even when i swap to another model. |
Hi @HampB , interesting issue. The easiest way to figure out if the schema is even retrieved from your BigQuery job is by printing out this this line https://github.com/ashish10alex/vscode-dataform-tools/blob/add_col_desc/src/bigqueryDryRun.ts#L56 I'd also add a log statement to print out
-- The only reason the schema would be stuck even if you change the active editor is if the next active editor is of type Please let me know what you get after trying the above |
Thanks @ashish10alex, seems like job.metadata.statistics.query.schema is undefined after a dry run. A bit strange, especially since it works sometimes. |
And if i look at a model where the schema actually loads, i cant seem to find any differences. They are both of the type "Table", have the same dataset, same project and so on... |
interesting, I do not have a single instance where it does not work for me. It even works on my personal gcp project. Is there any other key in the job object which has the schema ? -- It might be worth trying the api in isolation e.g take the code where we get the job and do try run put it in a test.js file and execute it in isolation with a a query e.g. |
It seems like it's actually the entire dry run that is not completing successfully, or perhaps it’s not being awaited correctly for the problematic models. When I add a breakpoint just before the return statement (here) on a non-working model, I need to press "continue" 2–3 times. During this process, the billed bytes remain at 0, and no schema appears. In contrast, when I do the same on a working model, the first 2–3 continues also show 0 bytes billed and no schema. However, additional breaks occur where the billed bytes start increasing, and the schema is eventually populated. I'll do some further testing tomorrow |
Testing this now gents. I am seeing the same issue, so just seeing if I can unpack it as well. |
thanks @benjaminwestern , is it possible to create a minimum reproducible example. e.g does adding the following model test.sqlx give you the following output ? config {
type: 'table',
assertions: {
uniqueKey: ["uniqueId"]
}
}
SELECT
1 AS UNIQUEID
, "myData" AS SOMECOLUMN
, CURRENT_DATE() AS TODAYS_DATE
![]() |
@HampB in this example I notice that statement type is |
Hi @HampB / @benjaminwestern, I believe I have found and fixed the issue that you guys might have encountered. The schema might not have been retrieved due to there being a pre operation before the main query. Since earlier we did the dry run on preOps + main query, the schema would not be retrieved if the preOps query was of type script. I have modified the dryRun config {
type: 'table',
}
pre_operations {
DROP TABLE IF EXISTS ${self()};
}
SELECT
1 AS UNIQUEID
, "myData" AS SOMECOLUMN
, CURRENT_DATE() AS TODAYS_DATE |
Ah, ofcource... Looking good now! A super simple example like this works;
|
It seems to have to do with setitng @@query_label in the pre_operations.
Where query_labe.from_object is:
A bit short on time today, but can keep investigating later on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now, nice feature!
Add description column to the table schema shown in the compiled query web view view nav bar. From my testing on Dataform graph with approx 280 nodes this functionality adds less than 20ms overhead. Also since computation is performed post the compiled query is displayed, the perceived latency is quite low / imperceptible to human eye.
Other minor changes
Promise.all