cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Save output of show table extended to table?

dplaut
New Contributor II

I want to save the output of 

    show table extended in catalogName like 'mysearchtext*';

to a table.

How do I do that?

4 REPLIES 4

Kaniz_Fatma
Community Manager
Community Manager

Hi @dplaut, To save the output of the SHOW TABLE EXTENDED command to a table, you can follow these steps:

 

First, execute the SHOW TABLE EXTENDED command with the desired regular expression pattern. This command provides detailed information about tables matching the given pattern, including basic table information, file system details, and more.

 

For example:

  1. SHOW TABLE EXTENDED LIKE โ€™'mysearchtext*';

Examine the output to ensure it contains the relevant details you want to save.

 

Create a new table where you'll store this information. You can use the CREATE TABLE statement to define the schema of your new table. Adjust the column names and data types as needed.

 

Insert the output of the SHOW TABLE EXTENDED command into your newly created table. You can do this using an INSERT INTO statement. Make sure to specify the appropriate column names and values from the output.

 

 

dplaut
New Contributor II

I can't get this to work. I get the error:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'SHOW'.line 2, pos 0

insert into my_target_table (database, tablename, istemporary, information)
SHOW TABLE EXTENDED LIKE 'mytable';

 

Hi @dplaut, Try this. You have missed a semicolon in your first statement.

 

insert into my_target_table (database, tablename, istemporary, information);

SHOW TABLE EXTENDED LIKE 'mytable';

dplaut
New Contributor II

I would not have expected that to work as it violates rules I know about SQL and the purpose of the semicolon. And it does not work.

[PARSE_SYNTAX_ERROR] Syntax error at or near end of input.line 1, pos 75

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group