Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch database model automatically #2

Closed
RazZziel opened this issue May 18, 2017 · 2 comments
Closed

Fetch database model automatically #2

RazZziel opened this issue May 18, 2017 · 2 comments

Comments

@RazZziel
Copy link

The README of the project states:

Similar to Looker and their LookML, insights requires you to define your data model in a file called insights.yml.
You use the insights_export gem to generate this file from your Rails Models. (Adapters for other frameworks coming soon.)

That means we can't just plug insights into our database and start exploring, we need to duplicate the SQL model in YAML first. Wouldn't it be possible to fetch this model automatically from the database?

In Python, SQLAlchemy's automap feature is able to extract that kind of information, is there any Ruby library providing that feature?

@RazZziel RazZziel changed the title Fetch table relations automatically Fetch database model automatically May 18, 2017
@mariusandra
Copy link
Owner

Hey,

The best solution here is to write a python plugin that uses automap to generate the insights.yml file for your database. You then add it to your requirements.txt file and integrate with your workflow to keep the file up to date.

I'm sure it's somehow possible to extract your database schema in Ruby as well, but even then, having an extra step to generate the yml file adds many features:

  • custom variables
  • hide models and fields from endusers
  • the developers have control over what your business users see
  • version control on the data
  • worse case insurance: intruders only have read access to the generated sql and can't execute arbitrary queries

It is definitely possible to replace the file with a nice interface that lets you configure all of that online, but that's a bit of an overkill at this stage

@RazZziel
Copy link
Author

RazZziel commented Jun 5, 2017

Hmmm, that may as well work, thanks!

@RazZziel RazZziel closed this as completed Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants