-
Notifications
You must be signed in to change notification settings - Fork 184
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
refactor!: proof_of_sql_parser::intermediate_ast::ResourceId
with sqlparser::ast::ObjectName
in the proof-of-sql crate
#449
base: main
Are you sure you want to change the base?
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.
Really thanks for your PR! I think it will be great if we add some helper function to produce a TableRef from multiple Strings / &strs. That way we can do something like table_ref(["namespace", "table_name"])
96bab42
to
f971384
Compare
…sqlparser::ast::ObjectName` in the proof-of-sql crate
1a2d1dd
to
a146bd2
Compare
// /// Error types for `TableRef`. | ||
// #[derive(Snafu, Debug, PartialEq, Eq)] | ||
// pub enum TableRefError { | ||
// #[snafu(display("Missing schema or table identifier in ObjectName"))] | ||
// MissingSchemaOrTable { | ||
// /// The problematic `ObjectName`. | ||
// object_name: ObjectName, | ||
// }, | ||
// } |
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.
Let's remove these please.
use core::{ | ||
fmt, | ||
fmt::{Display, Formatter}, | ||
str::FromStr, | ||
}; | ||
use proof_of_sql_parser::{impl_serde_from_str, ResourceId}; | ||
use sqlparser::ast::Ident; | ||
// use snafu::Snafu; |
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
#[must_use] | ||
pub fn new(resource_id: ResourceId) -> Self { | ||
Self { resource_id } | ||
pub fn new(object_name: ObjectName) -> Self { |
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.
Hmm we either do not allow ObjectName
with other than one or two Ident
for TableRef
or we can put two Idents there with schema_name optional. Personally I prefer the latter option.
Please be sure to look over the pull request guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md#submit-pr.
Please go through the following checklist
!
is used if and only if at least one breaking change has been introduced.source scripts/run_ci_checks.sh
.Rationale for this change
This PR addresses the need to replace the
proof_of_sql_parser::ResourceId
with thesqlparser::ast::ObjectName
in theproof-of-sql
crate as part of a larger transition toward integrating thesqlparser
.This change is a subtask of issue #235, with the main goal of streamlining the repository by switching to the
sqlparser
crate and gradually replacing intermediary constructs likeproof_of_sql_parser::intermediate_ast
withsqlparser::ast
.What changes are included in this PR?
proof_of_sql_parser::ResourceId
have been replaced withsqlparser::ast::ObjectName
ResourceId
has been updated to maintain the original functionality, ensuring no changes to the logic or behavior.ObjectName
doesn't supportCopy
trait so we have needed few clones in the places where values are movedAre these changes tested?
Yes
Part of #235
Fixes #352