Skip to content

Allow selecting from collections with inconsistent properties #19

@ropjov

Description

@ropjov

Is your feature request related to a problem? Please describe.
I am trying to visualise some of my Firestore data with Grafana. But the issue is that the collection I am trying to query using FireQL does not have a consistent set of properties, since it's collecting daily data, and not every day may have all data.

For example:
SELECT * FROM inconsistent_property_collection throws fireql.Execute: unknown field "inconsistentProperty" in doc "2023-10-18"

Describe the solution you'd like
I think allowing properties to not be consistent, and considering them a SQL NULL when they are not present would make this library, and specially the usage from Grafana that much more useful. Otherwise, most Firestore-like collections won't work with FireQL, since Firestore does not enforce consistent properties.

Also, to keep back-wards compatibility this new behaviour could require an opt-in, and could use an SQL-like syntax. For example:
SET allow_inconsistent_properties = true; SELECT * FROM inconsistent_property_collection

or

SELECT * FROM inconsistent_property_collection ALLOW undefined_properties

Describe alternatives you've considered
The main alternative I have considered is to stop using FireQL and Firestore and use Postgres. I don't see a way to get this working with my type of collections.

Additional context
All of this was tested using the latest version of the Grafana Firestore integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions