This repository has been archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidying up duplication between /docs and docs.datafold.com (#495)
* remove how to use file, which is duplicative of docs.datafold.com * post questions in github discussions * update docs/index.rst * remove use cases * Create python_examples.rst --------- Co-authored-by: Will Sweet <[email protected]>
- Loading branch information
1 parent
ed971de
commit 25692cb
Showing
4 changed files
with
48 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Python API Examples | ||
--------- | ||
|
||
**Example 1: Diff tables in mysql and postgresql** | ||
|
||
.. code-block:: python | ||
# Optional: Set logging to display the progress of the diff | ||
import logging | ||
logging.basicConfig(level=logging.INFO) | ||
from data_diff import connect_to_table, diff_tables | ||
table1 = connect_to_table("postgresql:///", "table_name", "id") | ||
table2 = connect_to_table("mysql:///", "table_name", "id") | ||
for different_row in diff_tables(table1, table2): | ||
plus_or_minus, columns = different_row | ||
print(plus_or_minus, columns) | ||
**Example 2: Connect to snowflake using dictionary configuration** | ||
|
||
.. code-block:: python | ||
SNOWFLAKE_CONN_INFO = { | ||
"driver": "snowflake", | ||
"user": "erez", | ||
"account": "whatever", | ||
"database": "TESTS", | ||
"warehouse": "COMPUTE_WH", | ||
"role": "ACCOUNTADMIN", | ||
"schema": "PUBLIC", | ||
"key": "snowflake_rsa_key.p8", | ||
} | ||
snowflake_table = connect_to_table(SNOWFLAKE_CONN_INFO, "table_name") # Uses id by default | ||
Run `help(connect_to_table)` and `help(diff_tables)` or read our API reference to learn more about the different options: | ||
|
||
- connect_to_table_ | ||
|
||
- diff_tables_ | ||
|
||
.. _connect_to_table: https://data-diff.readthedocs.io/en/latest/python-api.html#data_diff.connect_to_table | ||
.. _diff_tables: https://data-diff.readthedocs.io/en/latest/python-api.html#data_diff.diff_tables |