Dynamically generate view definition for odbc cosmos data source

Author: Abhijay Khandelwal

Originally Sourced from: https://stackoverflow.com/questions/60413468/dynamically-generate-view-definition-for-odbc-cosmos-data-source

There is requirement that where my 3rd party application needs to connect with cosmos DB. So I setup an ODBC connection for COSMOS via ODBC Cosmos Driver. In my cosmos account containers are dynamically generated. Problem is in some cases I am not be able to query some columns via ODBC. These are not nested properties in document.

I also tried one workaround solution by going in Schema Editor > Schema Definition > View Definition > Add New view.By this i am able to get the data. But as said my containers are dynamically generated, so how can i add view definition dynamically to containers.