mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
* Removed commented lines
* Renamed "Database Name"/dbname to "Database Path"/dbpath
This commit is contained in:
parent
68001ae0f1
commit
e0a43a32ab
@ -3,18 +3,9 @@ import logging
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
#from redash.query_runner import ValidationError
|
|
||||||
from redash.query_runner import BaseQueryRunner
|
from redash.query_runner import BaseQueryRunner
|
||||||
#from redash.query_runner import TYPE_DATETIME
|
|
||||||
#from redash.query_runner import TYPE_BOOLEAN
|
|
||||||
#from redash.query_runner import TYPE_INTEGER
|
|
||||||
from redash.query_runner import TYPE_STRING
|
from redash.query_runner import TYPE_STRING
|
||||||
#from redash.query_runner import TYPE_DATE
|
|
||||||
#from redash.query_runner import TYPE_FLOAT
|
|
||||||
#from redash.query_runner import SUPPORTED_COLUMN_TYPES
|
|
||||||
from redash.query_runner import register
|
from redash.query_runner import register
|
||||||
#from redash.query_runner import get_query_runner
|
|
||||||
#from redash.query_runner import import_query_runners
|
|
||||||
|
|
||||||
from redash.utils import JSONEncoder
|
from redash.utils import JSONEncoder
|
||||||
|
|
||||||
@ -26,12 +17,12 @@ class Sqlite(BaseQueryRunner):
|
|||||||
return {
|
return {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"dbname": {
|
"dbpath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "Database Name"
|
"title": "Database Path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["dbname"],
|
"required": ["dbpath"],
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -41,7 +32,7 @@ class Sqlite(BaseQueryRunner):
|
|||||||
def __init__(self, configuration_json):
|
def __init__(self, configuration_json):
|
||||||
super(Sqlite, self).__init__(configuration_json)
|
super(Sqlite, self).__init__(configuration_json)
|
||||||
|
|
||||||
self._dbname = self.configuration['dbname']
|
self._dbpath = self.configuration['dbpath']
|
||||||
|
|
||||||
def get_schema(self):
|
def get_schema(self):
|
||||||
query_table = "select tbl_name from sqlite_master where type='table'"
|
query_table = "select tbl_name from sqlite_master where type='table'"
|
||||||
@ -69,7 +60,7 @@ class Sqlite(BaseQueryRunner):
|
|||||||
return schema.values()
|
return schema.values()
|
||||||
|
|
||||||
def run_query(self, query):
|
def run_query(self, query):
|
||||||
connection = sqlite3.connect(self._dbname)
|
connection = sqlite3.connect(self._dbpath)
|
||||||
|
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user