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

feat: add -c option to pass the SQL query directly as an argument on datafusion-cli #6765

Merged
merged 3 commits into from
Jun 26, 2023

Conversation

r4ntix
Copy link
Contributor

@r4ntix r4ntix commented Jun 26, 2023

Which issue does this PR close?

Closes #6763

Rationale for this change

See #6763

What changes are included in this PR?

  • add -c option to pass the SQL query directly as an argument on datafusion-cli

Are these changes tested?

  • considering the increasing feature richness of the cli, I added integration tests.

Are there any user-facing changes?

Add -c option on datafusion-cli

@r4ntix r4ntix marked this pull request as ready for review June 26, 2023 15:02
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.

considering the increasing feature richness of the cli, I added integration tests.

Thank you @r4ntix !

I also tested this locally and it works great ❤️

/Users/alamb/Software/target-df/debug/datafusion-cli -c 'show tables';
DataFusion CLI v26.0.0
+---------------+--------------------+-------------+------------+
| table_catalog | table_schema       | table_name  | table_type |
+---------------+--------------------+-------------+------------+
| datafusion    | information_schema | tables      | VIEW       |
| datafusion    | information_schema | views       | VIEW       |
| datafusion    | information_schema | columns     | VIEW       |
| datafusion    | information_schema | df_settings | VIEW       |
+---------------+--------------------+-------------+------------+
4 rows in set. Query took 0.005 seconds.


#[rstest]
#[case::exec_from_commands(
["--command", "select 1", "--format", "json", "-q"],
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ I love it

@alamb
Copy link
Contributor

alamb commented Jun 26, 2023

I also doubled checked the new tests are run as part of CI:

https://github.com/apache/arrow-datafusion/actions/runs/5378911179/jobs/9759609935?pr=6765

Screenshot 2023-06-26 at 4 26 37 PM

THanks again @r4ntix -- this PR is really neat

@alamb alamb merged commit 7d3cae0 into apache:main Jun 26, 2023
@r4ntix r4ntix deleted the issue-6763 branch June 27, 2023 01:49
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.

Allow usage of datafusion-cli from other programs
2 participants