Skip to content

docs: improve docstrings on methods using the database param #11112

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

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

Conversation

NickCrews
Copy link
Contributor

I removed many docstrings from subclasses, which should lead to them inheriting the docstring of the base class. This should make the docstrings easier to maintain and less lilely to drift.

I also linked to the concepts doc that @gforsyth wrote, but that never was included in the index or linked to anywhere. I think it should be surfaced somewhere more obvious.

@NickCrews NickCrews added the docs-preview Add this label to trigger a docs preview label Apr 9, 2025
@github-actions github-actions bot added docs Documentation related issues or PRs impala The Apache Impala backend postgres The PostgreSQL backend sqlite The SQLite backend clickhouse The ClickHouse backend mysql The MySQL backend pyspark The Apache PySpark backend datafusion The Apache DataFusion backend bigquery The BigQuery backend duckdb The DuckDB backend sql Backends that generate SQL snowflake The Snowflake backend mssql The Microsoft SQL Server backend trino The Trino backend druid The Apache Druid backend oracle The Oracle backend exasol Issues related to the exasol backend risingwave The RisingWave backend databricks The Databricks backend athena The Amazon Athena backend and removed docs-preview Add this label to trigger a docs preview labels Apr 9, 2025
Copy link
Member

@gforsyth gforsyth left a comment

Choose a reason for hiding this comment

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

Thanks for improving the docs, @NickCrews ! One (copy-pasted) spelling error to fix, and I think we should case DuckDB when using it in prose.

I also need to check if ipython style "superhelp" correctly pulls docstrings from the parent class (I'm pretty sure it does, but I remember some issues a while back)

Update: superhelp works just fine.

Comment on lines +1055 to +1106
>>> con = ibis.duckdb.connect()
>>> foo = con.create_table("foo", schema=ibis.schema(dict(a="int")))
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, is it weird that all backends list_tables will show a duckdb example?

Copy link
Member

Choose a reason for hiding this comment

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

It's slightly weird. We can probably DOCTEST: +SKIP these and just make a 100% handcrafted example. The API output of list_tables is very stable.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this needs to be done in this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we make a different example for every backend, then this is going to lead to drift in docstrings between backends. This drift is bad, because specific backends often have not very good docstrings. This already happens, and in this PR I attempt to reduce this drift. I would rather have one place where the docstring is defined, I don't think this is too confusing, I think it should be fairly obvious that they can replace ibis.duckdb.connect() with ibis.datafusion.connect() and everything else will be the same.

Copy link
Member

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

Copy link
Contributor

github-actions bot commented Apr 12, 2025

The PR title and description conform to the Conventional Commits specification.

@github-actions github-actions bot added the flink Issues or PRs related to Flink label Apr 13, 2025
@NickCrews NickCrews force-pushed the database-docs branch 2 times, most recently from d20e674 to 2d80b4f Compare April 13, 2025 19:39
@NickCrews
Copy link
Contributor Author

To get the datafusion tests to pass, I had to dig into getting the current database and catalog for datafusion. I ended up implementing this, and adding HasCurrentDatabase and HasCurrentCatalog abstract base classes so all backends would share the same docstrings. So the scope is a bit larger than before. @cpcloud you probably want to give this another lookover after these adjustments.

@cpcloud
Copy link
Member

cpcloud commented Apr 21, 2025

@NickCrews This seems to break a lot of datafusion functionality for reasons that are unclear to me.

@cpcloud cpcloud marked this pull request as draft April 21, 2025 12:23
@github-actions github-actions bot added the tests Issues or PRs related to tests label Apr 23, 2025
@NickCrews NickCrews marked this pull request as ready for review April 23, 2025 22:25
@NickCrews
Copy link
Contributor Author

@cpcloud @gforsyth once CI passes this is ready for another review, I fixed the datafusion tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
athena The Amazon Athena backend bigquery The BigQuery backend clickhouse The ClickHouse backend databricks The Databricks backend datafusion The Apache DataFusion backend docs Documentation related issues or PRs druid The Apache Druid backend duckdb The DuckDB backend exasol Issues related to the exasol backend flink Issues or PRs related to Flink impala The Apache Impala backend mssql The Microsoft SQL Server backend mysql The MySQL backend oracle The Oracle backend postgres The PostgreSQL backend pyspark The Apache PySpark backend risingwave The RisingWave backend snowflake The Snowflake backend sql Backends that generate SQL sqlite The SQLite backend tests Issues or PRs related to tests trino The Trino backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants