extensions icon indicating copy to clipboard operation
extensions copied to clipboard

BigQuery export: Add option to include `path_params` in schema views

Open jorroll opened this issue 3 years ago • 7 comments

[REQUIRED] Step 2: Extension name

This feature request is for extension: firestore-bigquery-export

  • Specifically it's for the @firebaseextensions/fs-bq-schema-views script

What feature would you like to see?

I'd like for the @firebaseextensions/fs-bq-schema-views script to have an option to include the path_params in the generated schema view.

How would you use it?

Using the path_params in SQL queries. The value of this feels self evident, but let me know if it's not.

jorroll avatar Sep 29 '22 09:09 jorroll

Hey @jorroll, thank you for raising this issue, I'll add it to the project tracker for further investigation.

yamankatby avatar Sep 29 '22 10:09 yamankatby

We got a similar need and it would be great to have this option

BenjaminKlatt avatar Oct 09 '22 12:10 BenjaminKlatt

Yes, this is super important.

otopba avatar Nov 11 '22 12:11 otopba

Workaround: The generated view query can be manually edited to get fields from 'path_params' instead of 'data'.

... FIRST_VALUE(JSON_EXTRACT_SCALAR(~~data~~ path_params, '$.classId')) OVER( PARTITION BY document_name ORDER BY timestamp DESC ) AS classId, ...

Having this in the script would be great. My suggestion for the schema json:

{ "name": "classId", "type": "string", "source": "path_params"}

rahulsekar avatar May 26 '23 08:05 rahulsekar

This is much needed indeed. I do have a Firestore structure with sub-collections and need this for an easier join between master and child documents.

I did add my path wildcard as a field manually to the view by just like @rahulsekar mentioned pretty easily.

conceptualben avatar Jul 15 '23 21:07 conceptualben

Seems like this feature doesn't exist yet. Would be great to have it. I'm thinking of an alternative approach, where I create another extra view that maps parent_id (parent collection) to child_id (child collection). This obviously assumes child collections have unique identifiers. Then I can join both tables to get the "path_params" id

luksfarris avatar Aug 02 '23 19:08 luksfarris