singlestoredb 1.12.0__tar.gz → 1.12.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

Files changed (154) hide show
  1. {singlestoredb-1.12.0/singlestoredb.egg-info → singlestoredb-1.12.1}/PKG-INFO +1 -1
  2. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/setup.cfg +1 -1
  3. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/__init__.py +1 -1
  4. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/utils.py +14 -8
  5. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/files.py +7 -8
  6. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/workspace.py +5 -6
  7. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_management.py +50 -2
  8. {singlestoredb-1.12.0 → singlestoredb-1.12.1/singlestoredb.egg-info}/PKG-INFO +1 -1
  9. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/LICENSE +0 -0
  10. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/README.md +0 -0
  11. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/accel.c +0 -0
  12. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/setup.py +0 -0
  13. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/ai/__init__.py +0 -0
  14. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/ai/embeddings.py +0 -0
  15. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/alchemy/__init__.py +0 -0
  16. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/__init__.py +0 -0
  17. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_cloud_functions.py +0 -0
  18. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_config.py +0 -0
  19. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_connection_info.py +0 -0
  20. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_dashboards.py +0 -0
  21. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_process.py +0 -0
  22. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_stdout_supress.py +0 -0
  23. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/apps/_uvicorn_util.py +0 -0
  24. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/auth.py +0 -0
  25. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/config.py +0 -0
  26. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/connection.py +0 -0
  27. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/converters.py +0 -0
  28. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/exceptions.py +0 -0
  29. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/__init__.py +0 -0
  30. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/decorator.py +0 -0
  31. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/dtypes.py +0 -0
  32. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/__init__.py +0 -0
  33. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/arrow.py +0 -0
  34. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/asgi.py +0 -0
  35. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/json.py +0 -0
  36. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/mmap.py +0 -0
  37. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/rowdat_1.py +0 -0
  38. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/ext/utils.py +0 -0
  39. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/functions/signature.py +0 -0
  40. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/__init__.py +0 -0
  41. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/graphql.py +0 -0
  42. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handler.py +0 -0
  43. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/__init__.py +0 -0
  44. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/export.py +0 -0
  45. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/files.py +0 -0
  46. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/job.py +0 -0
  47. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/models.py +0 -0
  48. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/stage.py +0 -0
  49. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/handlers/workspace.py +0 -0
  50. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/registry.py +0 -0
  51. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/fusion/result.py +0 -0
  52. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/http/__init__.py +0 -0
  53. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/http/connection.py +0 -0
  54. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/magics/__init__.py +0 -0
  55. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/magics/run_personal.py +0 -0
  56. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/magics/run_shared.py +0 -0
  57. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/__init__.py +0 -0
  58. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/billing_usage.py +0 -0
  59. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/cluster.py +0 -0
  60. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/export.py +0 -0
  61. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/job.py +0 -0
  62. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/manager.py +0 -0
  63. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/organization.py +0 -0
  64. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/region.py +0 -0
  65. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/management/utils.py +0 -0
  66. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/__init__.py +0 -0
  67. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/_auth.py +0 -0
  68. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/charset.py +0 -0
  69. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/connection.py +0 -0
  70. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/CLIENT.py +0 -0
  71. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/COMMAND.py +0 -0
  72. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/CR.py +0 -0
  73. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/ER.py +0 -0
  74. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/EXTENDED_TYPE.py +0 -0
  75. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/FIELD_TYPE.py +0 -0
  76. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/FLAG.py +0 -0
  77. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/SERVER_STATUS.py +0 -0
  78. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/VECTOR_TYPE.py +0 -0
  79. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/constants/__init__.py +0 -0
  80. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/converters.py +0 -0
  81. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/cursors.py +0 -0
  82. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/err.py +0 -0
  83. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/optionfile.py +0 -0
  84. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/protocol.py +0 -0
  85. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/__init__.py +0 -0
  86. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/base.py +0 -0
  87. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/conftest.py +0 -0
  88. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_DictCursor.py +0 -0
  89. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_SSCursor.py +0 -0
  90. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_basic.py +0 -0
  91. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_connection.py +0 -0
  92. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_converters.py +0 -0
  93. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_cursor.py +0 -0
  94. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_err.py +0 -0
  95. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_issues.py +0 -0
  96. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_load_local.py +0 -0
  97. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_nextset.py +0 -0
  98. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/test_optionfile.py +0 -0
  99. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/__init__.py +0 -0
  100. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +0 -0
  101. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/capabilities.py +0 -0
  102. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/dbapi20.py +0 -0
  103. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +0 -0
  104. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +0 -0
  105. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +0 -0
  106. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/mysql/times.py +0 -0
  107. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/notebook/__init__.py +0 -0
  108. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/notebook/_objects.py +0 -0
  109. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/notebook/_portal.py +0 -0
  110. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/py.typed +0 -0
  111. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/pytest.py +0 -0
  112. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/server/__init__.py +0 -0
  113. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/server/docker.py +0 -0
  114. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/server/free_tier.py +0 -0
  115. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/__init__.py +0 -0
  116. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/empty.sql +0 -0
  117. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/ext_funcs/__init__.py +0 -0
  118. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/local_infile.csv +0 -0
  119. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test.ipynb +0 -0
  120. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test.sql +0 -0
  121. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test2.ipynb +0 -0
  122. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test2.sql +0 -0
  123. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_basics.py +0 -0
  124. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_config.py +0 -0
  125. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_connection.py +0 -0
  126. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_dbapi.py +0 -0
  127. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_exceptions.py +0 -0
  128. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_ext_func.py +0 -0
  129. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_ext_func_data.py +0 -0
  130. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_fusion.py +0 -0
  131. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_http.py +0 -0
  132. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_plugin.py +0 -0
  133. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_results.py +0 -0
  134. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_types.py +0 -0
  135. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_udf.py +0 -0
  136. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/test_xdict.py +0 -0
  137. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/tests/utils.py +0 -0
  138. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/types.py +0 -0
  139. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/__init__.py +0 -0
  140. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/config.py +0 -0
  141. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/convert_rows.py +0 -0
  142. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/debug.py +0 -0
  143. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/dtypes.py +0 -0
  144. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/events.py +0 -0
  145. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/mogrify.py +0 -0
  146. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/results.py +0 -0
  147. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb/utils/xdict.py +0 -0
  148. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb.egg-info/SOURCES.txt +0 -0
  149. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb.egg-info/dependency_links.txt +0 -0
  150. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb.egg-info/entry_points.txt +0 -0
  151. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb.egg-info/requires.txt +0 -0
  152. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/singlestoredb.egg-info/top_level.txt +0 -0
  153. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/sqlx/__init__.py +0 -0
  154. {singlestoredb-1.12.0 → singlestoredb-1.12.1}/sqlx/magic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.12.0
3
+ Version: 1.12.1
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = singlestoredb
3
- version = 1.12.0
3
+ version = 1.12.1
4
4
  description = Interface to the SingleStoreDB database and workspace management APIs
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.12.0'
16
+ __version__ = '1.12.1'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -7,13 +7,11 @@ from typing import Optional
7
7
  from typing import Union
8
8
 
9
9
  from ...exceptions import ManagementError
10
+ from ...management import files as mgmt_files
10
11
  from ...management import manage_workspaces
11
12
  from ...management.files import FilesManager
12
13
  from ...management.files import FileSpace
13
14
  from ...management.files import manage_files
14
- from ...management.files import MODELS_SPACE
15
- from ...management.files import PERSONAL_SPACE
16
- from ...management.files import SHARED_SPACE
17
15
  from ...management.workspace import StarterWorkspace
18
16
  from ...management.workspace import Workspace
19
17
  from ...management.workspace import WorkspaceGroup
@@ -190,6 +188,10 @@ def get_deployment(
190
188
  * params['group']['deployment_id']
191
189
  * params['in_deployment']['deployment_name']
192
190
  * params['in_deployment']['deployment_id']
191
+ * params['in']['in_group']['deployment_name']
192
+ * params['in']['in_group']['deployment_id']
193
+ * params['in']['in_deployment']['deployment_name']
194
+ * params['in']['in_deployment']['deployment_id']
193
195
 
194
196
  Or, from the SINGLESTOREDB_WORKSPACE_GROUP
195
197
  or SINGLESTOREDB_CLUSTER environment variables.
@@ -199,7 +201,9 @@ def get_deployment(
199
201
 
200
202
  deployment_name = params.get('deployment_name') or \
201
203
  (params.get('in_deployment') or {}).get('deployment_name') or \
202
- (params.get('group') or {}).get('deployment_name')
204
+ (params.get('group') or {}).get('deployment_name') or \
205
+ ((params.get('in') or {}).get('in_group') or {}).get('deployment_name') or \
206
+ ((params.get('in') or {}).get('in_deployment') or {}).get('deployment_name')
203
207
  if deployment_name:
204
208
  workspace_groups = [
205
209
  x for x in manager.workspace_groups
@@ -239,7 +243,9 @@ def get_deployment(
239
243
 
240
244
  deployment_id = params.get('deployment_id') or \
241
245
  (params.get('in_deployment') or {}).get('deployment_id') or \
242
- (params.get('group') or {}).get('deployment_id')
246
+ (params.get('group') or {}).get('deployment_id') or \
247
+ ((params.get('in') or {}).get('in_group') or {}).get('deployment_id') or \
248
+ ((params.get('in') or {}).get('in_deployment') or {}).get('deployment_id')
243
249
  if deployment_id:
244
250
  try:
245
251
  return manager.get_workspace_group(deployment_id)
@@ -298,11 +304,11 @@ def get_file_space(params: Dict[str, Any]) -> FileSpace:
298
304
  if file_location:
299
305
  file_location_lower_case = file_location.lower()
300
306
 
301
- if file_location_lower_case == PERSONAL_SPACE:
307
+ if file_location_lower_case == mgmt_files.PERSONAL_SPACE:
302
308
  return manager.personal_space
303
- elif file_location_lower_case == SHARED_SPACE:
309
+ elif file_location_lower_case == mgmt_files.SHARED_SPACE:
304
310
  return manager.shared_space
305
- elif file_location_lower_case == MODELS_SPACE:
311
+ elif file_location_lower_case == mgmt_files.MODELS_SPACE:
306
312
  return manager.models_space
307
313
  else:
308
314
  raise ValueError(f'invalid file location: {file_location}')
@@ -10,11 +10,9 @@ import re
10
10
  from abc import ABC
11
11
  from abc import abstractmethod
12
12
  from typing import Any
13
- from typing import BinaryIO
14
13
  from typing import Dict
15
14
  from typing import List
16
15
  from typing import Optional
17
- from typing import TextIO
18
16
  from typing import Union
19
17
 
20
18
  from .. import config
@@ -362,7 +360,7 @@ class FileLocation(ABC):
362
360
  @abstractmethod
363
361
  def upload_file(
364
362
  self,
365
- local_path: Union[PathLike, TextIO, BinaryIO],
363
+ local_path: Union[PathLike, io.IOBase],
366
364
  path: PathLike,
367
365
  *,
368
366
  overwrite: bool = False,
@@ -385,7 +383,7 @@ class FileLocation(ABC):
385
383
  @abstractmethod
386
384
  def _upload(
387
385
  self,
388
- content: Union[str, bytes, TextIO, BinaryIO],
386
+ content: Union[str, bytes, io.IOBase],
389
387
  path: PathLike,
390
388
  *,
391
389
  overwrite: bool = False,
@@ -628,7 +626,7 @@ class FileSpace(FileLocation):
628
626
 
629
627
  def upload_file(
630
628
  self,
631
- local_path: Union[PathLike, TextIO, BinaryIO],
629
+ local_path: Union[PathLike, io.IOBase],
632
630
  path: PathLike,
633
631
  *,
634
632
  overwrite: bool = False,
@@ -646,7 +644,7 @@ class FileSpace(FileLocation):
646
644
  Should the ``path`` be overwritten if it exists already?
647
645
 
648
646
  """
649
- if isinstance(local_path, (TextIO, BinaryIO)):
647
+ if isinstance(local_path, io.IOBase):
650
648
  pass
651
649
  elif not os.path.isfile(local_path):
652
650
  raise IsADirectoryError(f'local path is not a file: {local_path}')
@@ -657,8 +655,9 @@ class FileSpace(FileLocation):
657
655
 
658
656
  self.remove(path)
659
657
 
660
- if isinstance(local_path, (TextIO, BinaryIO)):
658
+ if isinstance(local_path, io.IOBase):
661
659
  return self._upload(local_path, path, overwrite=overwrite)
660
+
662
661
  return self._upload(open(local_path, 'rb'), path, overwrite=overwrite)
663
662
 
664
663
  def upload_folder(
@@ -727,7 +726,7 @@ class FileSpace(FileLocation):
727
726
 
728
727
  def _upload(
729
728
  self,
730
- content: Union[str, bytes, TextIO, BinaryIO],
729
+ content: Union[str, bytes, io.IOBase],
731
730
  path: PathLike,
732
731
  *,
733
732
  overwrite: bool = False,
@@ -10,11 +10,9 @@ import re
10
10
  import time
11
11
  from collections.abc import Mapping
12
12
  from typing import Any
13
- from typing import BinaryIO
14
13
  from typing import Dict
15
14
  from typing import List
16
15
  from typing import Optional
17
- from typing import TextIO
18
16
  from typing import Union
19
17
 
20
18
  from .. import config
@@ -165,7 +163,7 @@ class Stage(FileLocation):
165
163
 
166
164
  def upload_file(
167
165
  self,
168
- local_path: Union[PathLike, TextIO, BinaryIO],
166
+ local_path: Union[PathLike, io.IOBase],
169
167
  stage_path: PathLike,
170
168
  *,
171
169
  overwrite: bool = False,
@@ -183,7 +181,7 @@ class Stage(FileLocation):
183
181
  Should the ``stage_path`` be overwritten if it exists already?
184
182
 
185
183
  """
186
- if isinstance(local_path, (TextIO, BinaryIO)):
184
+ if isinstance(local_path, io.IOBase):
187
185
  pass
188
186
  elif not os.path.isfile(local_path):
189
187
  raise IsADirectoryError(f'local path is not a file: {local_path}')
@@ -194,8 +192,9 @@ class Stage(FileLocation):
194
192
 
195
193
  self.remove(stage_path)
196
194
 
197
- if isinstance(local_path, (TextIO, BinaryIO)):
195
+ if isinstance(local_path, io.IOBase):
198
196
  return self._upload(local_path, stage_path, overwrite=overwrite)
197
+
199
198
  return self._upload(open(local_path, 'rb'), stage_path, overwrite=overwrite)
200
199
 
201
200
  def upload_folder(
@@ -258,7 +257,7 @@ class Stage(FileLocation):
258
257
 
259
258
  def _upload(
260
259
  self,
261
- content: Union[str, bytes, TextIO, BinaryIO],
260
+ content: Union[str, bytes, io.IOBase],
262
261
  stage_path: PathLike,
263
262
  *,
264
263
  overwrite: bool = False,
@@ -414,8 +414,12 @@ class TestStage(unittest.TestCase):
414
414
  with self.assertRaises(OSError):
415
415
  st.upload_file(TEST_DIR / 'test.sql', 'upload_test.sql')
416
416
 
417
- # Force overwrite with new content
418
- f = st.upload_file(TEST_DIR / 'test2.sql', 'upload_test.sql', overwrite=True)
417
+ # Force overwrite with new content; use file object this time
418
+ f = st.upload_file(
419
+ open(TEST_DIR / 'test2.sql', 'r'),
420
+ 'upload_test.sql',
421
+ overwrite=True,
422
+ )
419
423
  assert str(f.path) == 'upload_test.sql'
420
424
  assert f.type == 'file'
421
425
 
@@ -1093,6 +1097,50 @@ class TestFileSpaces(unittest.TestCase):
1093
1097
  # Cleanup
1094
1098
  space.remove('upload_test.ipynb')
1095
1099
 
1100
+ def test_upload_file_io(self):
1101
+ for space in [self.personal_space, self.shared_space]:
1102
+ root = space.info('/')
1103
+ assert str(root.path) == '/'
1104
+ assert root.type == 'directory'
1105
+
1106
+ # Upload files
1107
+ f = space.upload_file(
1108
+ open(TEST_DIR / 'test.ipynb', 'r'),
1109
+ 'upload_test.ipynb',
1110
+ )
1111
+ assert str(f.path) == 'upload_test.ipynb'
1112
+ assert f.type == 'notebook'
1113
+
1114
+ # Download and compare to original
1115
+ txt = f.download(encoding='utf-8')
1116
+ assert txt == open(TEST_DIR / 'test.ipynb').read()
1117
+
1118
+ # Make sure we can't overwrite
1119
+ with self.assertRaises(OSError):
1120
+ space.upload_file(
1121
+ open(TEST_DIR / 'test.ipynb', 'r'),
1122
+ 'upload_test.ipynb',
1123
+ )
1124
+
1125
+ # Force overwrite with new content
1126
+ f = space.upload_file(
1127
+ open(TEST_DIR / 'test2.ipynb', 'r'),
1128
+ 'upload_test.ipynb', overwrite=True,
1129
+ )
1130
+ assert str(f.path) == 'upload_test.ipynb'
1131
+ assert f.type == 'notebook'
1132
+
1133
+ # Verify new content
1134
+ txt = f.download(encoding='utf-8')
1135
+ assert txt == open(TEST_DIR / 'test2.ipynb').read()
1136
+
1137
+ # Make sure we can't upload a folder
1138
+ with self.assertRaises(s2.ManagementError):
1139
+ space.upload_folder(TEST_DIR, 'test')
1140
+
1141
+ # Cleanup
1142
+ space.remove('upload_test.ipynb')
1143
+
1096
1144
  def test_open(self):
1097
1145
  for space in [self.personal_space, self.shared_space]:
1098
1146
  # See if error is raised for non-existent file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.12.0
3
+ Version: 1.12.1
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
File without changes
File without changes
File without changes
File without changes