Am Mo., 3. Jan. 2022 um 20:44 Uhr schrieb Gavin Ray <[email protected]>:

> @Stamatis
>
> Thank you, I actually did not know that! That's useful information to
> have =)
>
> @Julian
>
> Is it possible to programmatically generate the JSON model? Why I ask is
> because part of the functionality I'm trying to mirror is the ability to
> add
> data sources dynamically while the app server is running
>
> So you might send a POST /metadata/datasource saying "Here is the info of a
> new
> data source I would like you to connect to" And then I need to figure out
> how to
> handle creating a Calcite source from it and adding the new datasource +
> schemas
> to the global pool of registered ones, if that makes sense
>
> Worst case I could write the JSON file to disk and load from the tempfile I
> suppose, right?
>

No need for writing to disk, you just can pass in a String representing the
JSON model. Here's an example:


https://github.com/moditect/jfr-analytics/blob/main/src/test/java/org/moditect/jfranalytics/JfrSchemaFactoryTest.java#L381-L388

Hth,

--Gunnar


>
>
>
> On Mon, Jan 3, 2022 at 1:30 PM Julian Hyde <[email protected]> wrote:
>
> > > Will try to figure out how to manually perform the process of creating
> a
> > > proper "Connection" object and adding the schemas to it.
> >
> >
> > Generally the best way is to write a JSON model, and then create a
> > connection using ‘jdbc:calcite:…model=...'. For that to work, your
> > component needs to implement ‘interface SchemaFactory’, i.e. be an
> adapter.
> >
> > Julian
> >
> >
>

Reply via email to