You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2021/02/04 15:41:49 UTC

[ignite-python-thin-client] 02/03: IGNITE-12975: SQL query do not create cache

This is an automated email from the ASF dual-hosted git repository.

isapego pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git

commit 83208c2ef87d5b241c45dd5fd8f5ec4b58e2a8df
Author: Igor Sapego <ig...@gmail.com>
AuthorDate: Thu Feb 4 18:39:57 2021 +0300

    IGNITE-12975: SQL query do not create cache
    
    This closes #12
---
 pyignite/client.py   |  2 +-
 tests/test_binary.py |  1 +
 tests/test_sql.py    | 10 +++++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pyignite/client.py b/pyignite/client.py
index 3202b78..f8072d8 100644
--- a/pyignite/client.py
+++ b/pyignite/client.py
@@ -586,7 +586,7 @@ class Client:
 
         conn = self.random_node
 
-        schema = self.get_or_create_cache(schema)
+        schema = self.get_cache(schema)
         result = sql_fields(
             conn, schema.cache_id, query_str,
             page_size, query_args, schema.name,
diff --git a/tests/test_binary.py b/tests/test_binary.py
index 46554ea..45d1d25 100644
--- a/tests/test_binary.py
+++ b/tests/test_binary.py
@@ -64,6 +64,7 @@ drop_query = 'DROP TABLE {} IF EXISTS'.format(table_sql_name)
 
 def test_sql_read_as_binary(client):
 
+    client.get_or_create_cache(scheme_name)
     client.sql(drop_query)
 
     # create table
diff --git a/tests/test_sql.py b/tests/test_sql.py
index 87383d3..15f84ee 100644
--- a/tests/test_sql.py
+++ b/tests/test_sql.py
@@ -13,12 +13,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import pytest
+
 from pyignite.api import (
     sql_fields, sql_fields_cursor_get_page,
-    cache_get_or_create, sql, sql_cursor_get_page,
+    sql, sql_cursor_get_page,
     cache_get_configuration,
 )
 from pyignite.datatypes.prop_codes import *
+from pyignite.exceptions import SQLError
 from pyignite.utils import entity_id, unwrap_binary
 
 initial_data = [
@@ -186,3 +189,8 @@ def test_long_multipage_query(client):
             assert value == field_number * page[0]
 
     client.sql(drop_query)
+
+
+def test_sql_not_create_cache(client):
+    with pytest.raises(SQLError, match=r".*Cache does not exist.*"):
+        client.sql(schema='IS_NOT_EXISTING', query_str='select * from IsNotExisting')