Closed e-gineer closed 3 years ago
Thanks for the review. I'll work on it.
On the metadata API, there is 2 problems right now:
I have done all the points (but the go mod tidy
didn't have any effect) except the use of the metadata API.
Hey @francois2metz , thanks for making the changes quickly! Sorry it took a while for me to get back to you with our other suggestions after some more testing. Please see below for additional suggestions, and let me know if you have any questions.
airtable/connection_config.go
and config/airtable.spc
, can you please update databaseid
to database_id
, as we typically use snake case for config options.select id, created_time, jsonb_pretty(fields) as fields from airtable_features where id = 'recpICqN81XFoQJ61'
Error: status 404, err: HTTP request failure on /v0/appCJx0MKL2MsYjul/Features/recpICqN81XFoQJ61 with status 404
Body: {"error":{"type":"MODEL_ID_NOT_FOUND"}}
Similarly, when a table doesn't exist or the database ID provided in the config doesn't exist, are you able to handle these as well, e.g.,
select id, created_time, jsonb_pretty(fields) as fields from airtable_bugs_and_issues where id = 'recpICqN81XFoQJ61'
Error: status 404, err: HTTP request failure on /v0/appQLhYOg7THhtehb/Bugs%!a(MISSING)nd%!I(MISSING)ssues/recpICqN81XFoQJ61 with status 404
Body: {"error":{"type":"TABLE_NOT_FOUND","message":"Could not find table Bugs and Issues in application appQLhYOg7THhtehb"}}
select id, created_time, jsonb_pretty(fields) as fields from airtable_bugs_and_issues where id = 'recpICqN81XFoQJ61'
Error: status 404, err: HTTP request failure on /v0/appQLhYOg7THhteh/Bugs%!a(MISSING)nd%!I(MISSING)ssues/recpICqN81XFoQJ61 with status 404
Body: {"error":"NOT_FOUND"}
filterbyFormula
parameter (https://support.airtable.com/hc/en-us/articles/223247187-How-do-I-sort-filter-or-retrieve-ordered-records-in-the-API-)? Is this parameter available in the SDK when retrieving records? If so, it may be useful to add as a new optional key column, to allow users to pass this filter in the where
clause for faster queries. For an example of how we handle a similar query/filter string in the Google Directory plugin, please see https://github.com/turbot/steampipe-plugin-googledirectory/blob/main/googledirectory/table_googledirectory_group.go#L33 and https://github.com/turbot/steampipe-plugin-googledirectory/blob/main/googledirectory/table_googledirectory_group.go#L126.When retrieving records, if a limit is passed in the query and is lower than 100, we should set max records to that limit for faster queries, e.g.,
// API can return maximum 100 records in a single page
maxResult := int64(100)
limit := d.QueryContext.Limit
if d.QueryContext.Limit != nil {
if *limit < maxResult {
maxResult = *limit
}
}
docs/tables/airtable_table.md
, in the last example, the last line has #>>'{}'
, is this meant to be part of the query?Hi @cbruno10,
Thanks a lot for the review and the suggestions.
I did all the stuff above and I released the version 0.0.3.
Does Airtable's API support retry and backoff today? If so, is this already handled in the SDK or something you can add?
The SDK handle the rate limit. I never ran into an Airtable error (and I use this plugin quite often).
In docs/tables/airtable_table.md, in the last example, the last line has #>>'{}', is this meant to be part of the query?
Yes it is. It's a way to get the real string value out of a jsonb string field :exploding_head:
Thanks for the quick updates @francois2metz !
We recently released the CSV plugin (https://hub.steampipe.io/plugins/turbot/csv), and based off of that release, we have some additional suggestions for compatibility with the CLI + Hub:
SchemaMode: plugin.SchemaModeDynamic
in the plugin function (like in https://github.com/turbot/steampipe-plugin-csv/blob/main/csv/plugin.go#L23), which allows the plugin to automatically reload the schema every time Steampipe starts (works with Steampipe CLI >= v0.9.0, set to release later this week, but backward compatible).airtable_table.md
, can you please update the filename, table name, and contents to match https://github.com/turbot/steampipe-plugin-csv/blob/main/docs/tables/%7Bcsv_filename%7D.md? These changes are meant to reflect the dynamic nature of the table. Some content in the linked example doc are specific to CSV files, so please change/exclude anything unrelated to your table.og_image
in docs/index.md
, set to /images/plugins/francois2metz/airtable-social-graphic.png
brand_color
in docs/index.md
to #18BFFF
I believe that after these changes are we done, we'll be ready for publishing the initial release.
If you have any questions, please let me know!
All done! Closing
Hey @francois2metz ... really great work on this new type of plugin!
I installed it easily and played around. Here are some suggestions:
[ "Bugs and issues" ]
, it wasn't clear to be whether to do theBugs%20and%20issues
format instead.airtable_bugs%20_and%20_issues
. I believe it would be better if these were simpler likeairtable_bugs_and_issues
.~created_time
column to the records in table.{Name: "created_time", Type: proto.ColumnType_TIMESTAMP, Description: "Time when the record was created."},
go mod tidy
to remove unneeded require statements from go.mod.GetConfig
to the table table. It will be much more efficient when getting a single item and appears to be supported by the SDK.Airtable tables can get very large, and the API has good support for limits, filters, etc. I recommend:
d.QueryStatus.RowsRemaining()
to stop paging queries etc once the query is cancelled or the number of rows has been reached. (New in Steampipe SDK v1.6.1).Harder, but (mostly?) doable:
airtable_base
table (or similar).select name from airtable_design_projects
, so much simpler than the JSON.We may have more later. Happy to discuss any of these or help! :-)