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
Support SHOW CREATE command #163
Comments
@amitvc this wil be a nice improvement |
Starting work on this today 4/29/2019. |
great. There is no need to write specific code in the CLI, I expect users to issue: or btw we can add something better once you implement the basic command. I am expecting this command to return a result set with a single column and a single raw. |
Great. Thanks for the hint. I will get the PR out soon. |
@diegosalvi @eolivelli The way I see how to implement this is we already store information in syscolumns system table regarding all column. For the primary key I can query sysindexcolumns table. Once I have the information I can return it format it in the systax for Create table and return it. Does this sound reasonable? |
./herddb-cli.sh -q "SELECT * FROM syscolumns where table_name = 'tsql2'"
./herddb-cli.sh -q "SELECT * FROM sysindexcolumns where table_name = 'tsql2'"
|
You have access to the Table object so you don't need to perform the query at all |
@eolivelli Good point. I see the necessary classes in herddb.core.system package. |
Will I need to add a new StatementExecutionResult implementation? The existing ones don't seem to fit this use case. I will most likely need to add a new type of TableAwareStatement. I also sent a note on describe tablename command to herddb mailing list. |
you will return a ResultSet like SELECT statements, that result set will have only one column and only one row, like we do for "EXPLAIN", that we are returning a fake result |
@eolivelli - I am thinking of using Tuple[DataAccessor] to send result of the show create table query across the network. In the ServerSideClientConnectionPeer class I am intercepting the query for 'show create table' but I am not sure if there is a utility method that takes the Tuple and gives me ByteBuf. |
@amitvc this is the trick
Here we are creating a dummy plan of type ValuesOp, which is a "constant"
|
Thanks, @eolivelli. I was thinking along the similar lines too just was confused about few things. Cool, I will have the PR out soon. |
Closed #390 |
Support an easy way to display table definition in a more SQL oriented and human friendly way.
The command SHOW CREATE TABLE
should display the SQL needed to create given table.The text was updated successfully, but these errors were encountered: