mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
improving the sql view
This commit is contained in:
parent
98ba32399e
commit
61b3a85d7a
@ -464,7 +464,7 @@ class SqlaTable(Model, Queryable, AuditMixinNullable):
|
||||
|
||||
@property
|
||||
def sql_url(self):
|
||||
return self.database.sql_url + "?table_id=" + str(self.id)
|
||||
return self.database.sql_url + "?table_name=" + str(self.table_name)
|
||||
|
||||
@property
|
||||
def sql_link(self):
|
||||
|
@ -54,7 +54,7 @@
|
||||
<h2>db: [{{ db }}]</h2>
|
||||
<div class="row interactions">
|
||||
<div class="col-xs-7 fillheight">
|
||||
<input type="hidden" id="database_id" value="{{ database_id }}">
|
||||
<input type="hidden" id="database_id" value="{{ db.id }}">
|
||||
<button class="btn btn-primary" id="run">Run!</button>
|
||||
<button class="btn btn-default" id="create_view">Create View</button>
|
||||
</div>
|
||||
@ -62,7 +62,7 @@
|
||||
<select id="dbtable">
|
||||
{% for t in tables %}
|
||||
<option value="{{ t }}"
|
||||
{{ "selected" if t == table }}>
|
||||
{{ "selected" if t == table_name else '' }}>
|
||||
{{ t }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
@ -75,9 +75,7 @@
|
||||
<textarea id="sql" class="fillup"></textarea>
|
||||
</div>
|
||||
<div class="col-xs-5 fillheight">
|
||||
<div class="metadata fillup bordered">
|
||||
Tables
|
||||
</div>
|
||||
<div class="metadata fillup bordered"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="interactive">
|
||||
|
@ -565,11 +565,12 @@ class Panoramix(BaseView):
|
||||
models.Database).filter_by(id=database_id).first()
|
||||
engine = mydb.get_sqla_engine()
|
||||
tables = engine.table_names()
|
||||
|
||||
table_name=request.args.get('table_name')
|
||||
return self.render_template(
|
||||
"panoramix/sql.html",
|
||||
database_id=database_id,
|
||||
table_id=request.args.get('table_id'),
|
||||
tables=tables,
|
||||
table_name=table_name,
|
||||
db=mydb)
|
||||
|
||||
@has_access
|
||||
@ -598,7 +599,7 @@ class Panoramix(BaseView):
|
||||
models.Database).filter_by(id=database_id).first()
|
||||
t = mydb.get_table(table_name)
|
||||
fields = ", ".join(
|
||||
[c.name for c in t.get_columns()] or "*")
|
||||
[c.name for c in t.columns] or "*")
|
||||
s = "SELECT\n{fields}\nFROM {table_name}".format(**locals())
|
||||
return self.render_template(
|
||||
"panoramix/ajah.html",
|
||||
|
Loading…
Reference in New Issue
Block a user