Skip to content

Commit

Permalink
Making progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 4, 2016
1 parent e8ae49d commit 50d7d0f
Show file tree
Hide file tree
Showing 9 changed files with 18,648 additions and 41 deletions.
17 changes: 17 additions & 0 deletions panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ def sqlalchemy_uri_decrypted(self):
conn.password = self.password
return str(conn)

@property
def sql_link(self):
return '<a href="/panoramix/sql/{}/">SQL</a>'.format(self.id)


class SqlaTable(Model, Queryable, AuditMixinNullable):
type = "table"
Expand Down Expand Up @@ -309,6 +313,7 @@ def perm(self):
return (
"[{self.database}].[{self.table_name}]"
"(id:{self.id})").format(self=self)

@property
def full_name(self):
return "[{self.database}].[{self.table_name}]".format(self=self)
Expand All @@ -320,6 +325,18 @@ def dttm_cols(self):
l.append(self.main_dttm_col)
return l

@property
def html(self):
import pandas as pd
t = ((c.column_name, c.type) for c in self.columns)
df = pd.DataFrame(t)
df.columns = ['field', 'type']
return df.to_html(
index=False,
classes=(
"dataframe table table-striped table-bordered "
"table-condensed"))

@property
def name(self):
return self.table_name
Expand Down
Loading

0 comments on commit 50d7d0f

Please sign in to comment.