Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Get table completion percentage #46

Closed
wants to merge 5 commits into from

Conversation

elsiehoffet-94
Copy link
Contributor

First attempt to compute column completion percentage on a table of a database with a simple sql query select count(column)/count(*) from table.

Closes #36

@elsiehoffet-94 elsiehoffet-94 changed the title Eh/compute db completion percentage Get table completion percentage Jul 27, 2020
from sqlalchemy.exc import OperationalError
import json

def get_col_completion(owner, table_name, sorted, db_model):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where will this be called? Do you think we should make it a route (as for get_db_schema)?

from sqlalchemy.exc import OperationalError
import json

def get_col_completion(owner, table_name, sorted, db_model):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do you think sorted will be useful?

db_drivers = {"POSTGRES": POSTGRES, "ORACLE": ORACLE}

credentials = {
'model': 'public',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public?

for column in column_list[:-1] :
query_tmp += f"round(count({column}) / count(*) * 100, 0), "
query_tmp += f"round(count({column_list[-1]}) / count(*) * 100, 0) "
sql_query = f"select {query_tmp} from {table}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could do that with sqlAlchemy?

@simonvadee
Copy link
Contributor

stale

@simonvadee simonvadee closed this Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add percentage of filled values for columns
3 participants