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

[components] Standardize duckdb table width when generating CLI snippet output #27997

Open
wants to merge 1 commit into
base: sean/components/clean-up-doc-snippets-snapshot-test
Choose a base branch
from

Conversation

smackesey
Copy link
Collaborator

@smackesey smackesey commented Feb 22, 2025

Summary & Motivation

Standardize output width for duckdb commands in docs snippets. We do this by executing them in a pseudoterminal using pexpect and setting duckdb's .maxwidth setting.

DuckDB's .maxwidth setting is extremely finicky and annoying. It is often silently ignored. The only way I could get it to reliably actuate was when running interactively from the command line. It seems to change it's behavior based on the kind of output stream it's hooked up to.

The solution here is unfortunately complex, but so far as I can tell there is no way at all to get duckdb to respect .maxwidth outside of a terminal environment. I tried using an -init script and many other things. It just silently ignores .maxwidth unless you are in a terminal. So we simulate a terminal with pexpect, which works. This same approach may prove useful in the future for other CLIs that try to detect a terminal.

How I Tested These Changes

Regenerated snippets locally, no changes-- previously it would generate a longer duckdb table than would be generated in CI.

Copy link
Collaborator Author

smackesey commented Feb 22, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@smackesey smackesey changed the title fix [components] Standardize duckdb table width when generating CLI snippet output Feb 22, 2025
@smackesey smackesey marked this pull request as ready for review February 22, 2025 14:43
Copy link

Deploy preview for dagster-docs ready!

Preview available at https://dagster-docs-gkai4iwir-elementl.vercel.app
https://sean-components-snapshot-test-duckdb.archive.dagster-docs.io

Direct link to changed pages:

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.

1 participant