looker-open-source / looker-explore-assistant

A React Application for interacting with Looker data through natural language.
MIT License
110 stars 76 forks source link

feat: add failsafe for missing bigquery connection #45

Closed gtricerriv closed 5 months ago

gtricerriv commented 5 months ago

In case a Bigquery connection is not configured or the user wants to include their primer examples to the bundle we can add a failsafe on useBigQueryExamples.ts to check for a connection variable in the environment and decide whether fetching the examples or using the ones in the 2nd-level folder explore-assistant-examples.

This works because .env is being loaded already by Webpack and we can do conditional compilation since the environment variables are available at build time.

I had to comment out the .env_example file as a tradeof but this ensures examples are only included in the bundle if a BigQuery connection is not set. Plus this is probably the least intrusive solution.

gtricerriv commented 5 months ago

@waziers Let me know if this is ok or needs further improvements