Skip to content
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

Add DESCRIBE statement #1169

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add DESCRIBE statement #1169

wants to merge 9 commits into from

Conversation

pythonbrad
Copy link
Contributor

@pythonbrad pythonbrad commented May 2, 2023

resolve #1113

gluesql> CREATE TABLE person(id INT PRIMARY KEY, name TEXT, age INT NOT NULL, alive BOOLEAN DEFAULT true);
gluesql> DESCRIBE person;
Field Type Null Key Default
id INT false PRIMARY KEY
name TEXT true
age INT false
alive BOOLEAN true TRUE

@pythonbrad pythonbrad marked this pull request as ready for review May 3, 2023 16:28
@pythonbrad
Copy link
Contributor Author

Auto-increment is not yet implemented in GlueSQL, but I have included the extra column for it.

Payload::ExplainTable(columns) => {
let columns = columns
.into_iter()
.map(|(field, data_type, nullable, key, default, extra)| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we don't have any fields to show on extra.
Looks like it would be better to remove extra.

.await?
.ok_or_else(|| ExecuteError::TableNotFound(table_name.to_owned()))?;

let output: Vec<(String, DataType, bool, String, String, String)> = column_defs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to wrap verbose tuple with struct like..

struct ExplainTableRow {
   name: String,
   data_type: DataType,
   nullable: bool,
   key: String,
   default: String,
}

@pythonbrad
Copy link
Contributor Author

@devgony , I applied your reviews

@devgony
Copy link
Collaborator

devgony commented May 7, 2023

Thank you for quick commit.
Can you do the cargo fmt and push again?

@pythonbrad
Copy link
Contributor Author

pythonbrad commented May 7, 2023

Thank you for quick commit.

Can you do the cargo fmt and push again?

Please, can you check the pkg/javascript/web/src/payload.rs ? The json result

@coveralls
Copy link

coveralls commented May 7, 2023

Pull Request Test Coverage Report for Build 6310736809

  • 150 of 151 (99.34%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.187%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core/src/executor/execute.rs 17 18 94.44%
Totals Coverage Status
Change from base Build 6282500644: 0.0%
Covered Lines: 50388
Relevant Lines: 50801

💛 - Coveralls

@devgony
Copy link
Collaborator

devgony commented May 20, 2023

Thank you for quick commit.
Can you do the cargo fmt and push again?

Please, can you check the pkg/javascript/web/src/payload.rs ? The json result

It seems like working well on web as well 👍

image

@pythonbrad
Copy link
Contributor Author

hi @panarch
is the pr ok ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support DESCRIBE statement
3 participants