Skip to content

Commit

Permalink
Use chdb package to mock clickhouse connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schmidt committed Jan 23, 2024
1 parent e61ad8d commit 28590e2
Show file tree
Hide file tree
Showing 28 changed files with 295 additions and 657 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

### Fixed

## [0.5.1]

**Full Changelog**: https://github.com/DeepLcom/sql-mock/compare/v0.5.0...v0.5.1

### Added

### Changed
* Use chdb to fully mock the Clickhouse connection


### Fixed
* Fixed generation of CTE names from references with hyphens

Expand Down
9 changes: 2 additions & 7 deletions docs/_sources/usage/clickhouse/settings.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@

# Settings

In order to use SQL Mock with Clickhouse, you need to provide the following environment variables when you run tests:
* `SQL_MOCK_CLICKHOUSE_HOST`: Host of your Clickhouse instance
* `SQL_MOCK_CLICKHOUSE_USER`: User you want to use for the connection
* `SQL_MOCK_CLICKHOUSE_PASSWORD`: Password of your user
* `SQL_MOCK_CLICKHOUSE_PORT`: Port of your Clickhouse instance

Having those environment variables enables SQL Mock to connect to your Clickhouse instance.
For Clickhouse, we fully mock the database using [chdb](https://github.com/chdb-io/chdb).
No additional settings are needed at the moment.
20 changes: 4 additions & 16 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,8 @@ <h2 id="H">H</h2>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="sql_mock.clickhouse.html#sql_mock.clickhouse.settings.ClickHouseSettings.host">host (sql_mock.clickhouse.settings.ClickHouseSettings attribute)</a>

<ul>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.host">(sql_mock.redshift.settings.RedshiftSettings attribute)</a>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.host">host (sql_mock.redshift.settings.RedshiftSettings attribute)</a>
</li>
</ul></li>
</ul></td>
</tr></table>

Expand Down Expand Up @@ -533,22 +529,16 @@ <h2 id="O">O</h2>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="sql_mock.clickhouse.html#sql_mock.clickhouse.settings.ClickHouseSettings.password">password (sql_mock.clickhouse.settings.ClickHouseSettings attribute)</a>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.password">password (sql_mock.redshift.settings.RedshiftSettings attribute)</a>

<ul>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.password">(sql_mock.redshift.settings.RedshiftSettings attribute)</a>
</li>
<li><a href="sql_mock.snowflake.html#sql_mock.snowflake.settings.SnowflakeSettings.password">(sql_mock.snowflake.settings.SnowflakeSettings attribute)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="sql_mock.clickhouse.html#sql_mock.clickhouse.settings.ClickHouseSettings.port">port (sql_mock.clickhouse.settings.ClickHouseSettings attribute)</a>

<ul>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.port">(sql_mock.redshift.settings.RedshiftSettings attribute)</a>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.port">port (sql_mock.redshift.settings.RedshiftSettings attribute)</a>
</li>
</ul></li>
</ul></td>
</tr></table>

Expand Down Expand Up @@ -806,11 +796,9 @@ <h2 id="U">U</h2>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="sql_mock.clickhouse.html#sql_mock.clickhouse.settings.ClickHouseSettings.user">user (sql_mock.clickhouse.settings.ClickHouseSettings attribute)</a>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.user">user (sql_mock.redshift.settings.RedshiftSettings attribute)</a>

<ul>
<li><a href="sql_mock.redshift.html#sql_mock.redshift.settings.RedshiftSettings.user">(sql_mock.redshift.settings.RedshiftSettings attribute)</a>
</li>
<li><a href="sql_mock.snowflake.html#sql_mock.snowflake.settings.SnowflakeSettings.user">(sql_mock.snowflake.settings.SnowflakeSettings attribute)</a>
</li>
</ul></li>
Expand Down
3 changes: 1 addition & 2 deletions docs/getting_started/quickstart.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<p class="caption" role="heading"><span class="caption-text">Basic Usage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../usage/defining_table_mocks.html">Defining table mocks</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/dbt.html">Use with dbt</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/dbt.html">Enhanced SQLMock with dbt Integration Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/your_sql_query_to_test.html">Your SQL query to test</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/result_assertion.html">Result assertion</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/default_values.html">Default values</a></li>
Expand All @@ -62,7 +62,6 @@
<ul>
<li class="toctree-l1"><a class="reference internal" href="../usage/bigquery/index.html">BigQuery</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/clickhouse/index.html">Clickhouse</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage/redshift/index.html">Redshift</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">API Reference</span></p>
<ul>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
3 changes: 1 addition & 2 deletions docs/robots.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<p class="caption" role="heading"><span class="caption-text">Basic Usage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="usage/defining_table_mocks.html">Defining table mocks</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/dbt.html">Use with dbt</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/dbt.html">Enhanced SQLMock with dbt Integration Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/your_sql_query_to_test.html">Your SQL query to test</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/result_assertion.html">Result assertion</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/default_values.html">Default values</a></li>
Expand All @@ -60,7 +60,6 @@
<ul>
<li class="toctree-l1"><a class="reference internal" href="usage/bigquery/index.html">BigQuery</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/clickhouse/index.html">Clickhouse</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage/redshift/index.html">Redshift</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">API Reference</span></p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='utf-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://deeplcom.github.io/sql-mock/en/faq.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/getting_started/installation.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/modules.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.bigquery.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.clickhouse.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.redshift.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.snowflake.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/examples.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/settings.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/examples.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/settings.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/genindex.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/py-modindex.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/search.html</loc></url></urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://deeplcom.github.io/sql-mock/en/faq.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/getting_started/installation.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/modules.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.bigquery.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.clickhouse.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.redshift.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/sql_mock.snowflake.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/clickhouse/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/clickhouse/settings.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/dbt.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/examples.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/redshift/settings.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/examples.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/index.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/usage/snowflake/settings.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/genindex.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/py-modindex.html</loc></url><url><loc>https://deeplcom.github.io/sql-mock/en/search.html</loc></url></urlset>
Loading

0 comments on commit 28590e2

Please sign in to comment.