yahoo / elide

Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.
https://elide.io
Other
1k stars 228 forks source link

How can I dynamically create a model and database table ? #2617

Closed gemufeng closed 2 years ago

gemufeng commented 2 years ago

I want to client can create a database table,pass field name and type from restapi, and then the back-end can automatically generate model, database table and API. How can I do it?

aklish commented 2 years ago

Some parts of Elide are not friendly for auto-generating models. ORMs like Hibernate do byte code manipulation of JVM classes - so they require the model to be recompiled.

That said, you could create a custom DataStore to manage your dynamic models (similar to what Elide does for Analytic models). Analytic models can be dynamically created and registered for example.

I would need more details on your use case.

gemufeng commented 2 years ago

I am developing a CMS system, which allows users to create dynamic model then generate restfull API,elide fully meets the functions of restful API and graphql API, but I don't know how to dynamically generate model and table.

aklish commented 2 years ago

This would be outside Elide - but what about a workflow that takes user input, feeds that to a templating engine to generate code/models, build the models, and redeploys your service?