-
Notifications
You must be signed in to change notification settings - Fork 13
Add QuestDB Tool to Kindling #314
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Standing up an entire QuestDB instance is very heavy by comparison to SQLite. I suspect there's a lot of optimization we can do to that startup, since this will only ever be a read only copy. In particular, an entire webserver complete with its own configuration GUI, plus many worker threads, seems like a crazy hit. I'd like us to start very small with how much QuestDB we're surfacing via Kindling.

- You've also got some (minor) style faults
|
||
val httpPort = ServerSocket(0).use { it.localPort } // web console port | ||
val config = """ | ||
pg.net.bind.to=0.0.0.0:$pgPort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be localhost, not 0.0.0.0, most likely, so we're not inadvertently exposing a questdb instance to the entire network
|
||
@Suppress("SqlResolve") | ||
val tables: List<Table> = connection | ||
.executeQuery("""SELECT table_name FROM tables();""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Doesn't need to be a triple quoted string
) | ||
} | ||
val size: Long | ||
connection.executeQuery("""SELECT diskSize FROM table_storage() WHERE tableName = '$tableName'""").use { rs -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Doesn't need to be a triple quoted string
Or, if it is, might as well format the SQL query nicer
val size: Long | ||
connection.executeQuery("""SELECT diskSize FROM table_storage() WHERE tableName = '$tableName'""").use { rs -> | ||
// Move the cursor to the first row. If there's no row, default to 0. | ||
size = if (rs.next()) rs.getLong("diskSize") else 0L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could collapse this to a single expression - val size = connection.executeQuery().use { rs.getLong() else 0L}
size = size, | ||
) | ||
} catch (e: Exception) { | ||
println("Warning: Could not process table '$tableName'. Error: ${e.message}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a logger
val value = resultSet.getObject(i + 1) | ||
when { | ||
types[i] == Boolean::class.javaObjectType -> value == 1 | ||
types[i] == Date::class.java && value is Number -> Date(value.toLong()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these sqlite-based datatype hacks still actually needed for quest?
resultSet.metaData.getColumnName(i + 1) | ||
} | ||
val types = List(columnCount) { i -> | ||
val isTimestamp = names[i].containsInOrder("tsmp", true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this isTimestamp stuff - makes sense for generic sqlite view, probably not needed for quest
@paul-griffith Ready for review again.
|
…estdb historian directory. The tool provides a table that shows tables to query, and a secondary paginated table for efficient querying over large exports.
…rtableTree component from the .idb tool.
Added a QuestDB Viewer tool to Kinding which takes a .zip export of a historian folder, and opens the export similar to the .idb viewer DB tool. Also includes refactor to move common components used in the .idb and quest tools to core.