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 documentation for prepare statements. #14639

Merged
merged 4 commits into from
Feb 13, 2025
Merged

Conversation

dhegberg
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Add basic documentation for SQL PREPARE and the handling in Datafusion. Named variables will be documented when .sql() support is implemented.

What changes are included in this PR?

Just documentation

Are these changes tested?

Just auto-builds.

Are there any user-facing changes?

No

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 13, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for this @dhegberg ❤️

I rendered it locally and it looks quite nice 👌 This is a great addition. Thank you so much

Screenshot 2025-02-13 at 6 33 01 AM

I


##### Datafusion Example

```rust
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to test that the doc examples run (and thus that they compile and remain working) we need to add an entry to core/src/lib.rs like this:

diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs
index 48ee8e46b..70b595442 100644
--- a/datafusion/core/src/lib.rs
+++ b/datafusion/core/src/lib.rs
@@ -962,6 +962,12 @@ doc_comment::doctest!(
     user_guide_sql_operators
 );

+#[cfg(doctest)]
+doc_comment::doctest!(
+    "../../../docs/source/user-guide/sql/prepared_statements.md",
+    user_guide_prepared_statements
+);
+
 #[cfg(doctest)]
 doc_comment::doctest!(
     "../../../docs/source/user-guide/sql/scalar_functions.md",

Then you can run the doc tests like this:

cargo test --doc -p datafusion -- prepared_statement

Since I had the code checked out anyways I went ahead and pushed the code to test the examples (and make those tests pass) to this PR

@github-actions github-actions bot added the core Core DataFusion crate label Feb 13, 2025
@alamb alamb merged commit 68306ac into apache:main Feb 13, 2025
25 checks passed
@alamb
Copy link
Contributor

alamb commented Feb 13, 2025

Thanks again @dhegberg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants