timeplus 1.4.1__tar.gz → 2.0.0b2__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.
Files changed (270) hide show
  1. {timeplus-1.4.1 → timeplus-2.0.0b2}/PKG-INFO +1 -1
  2. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/api_client.py +10 -1
  3. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_analyze.py +2 -2
  4. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_dbapi.py +13 -16
  5. timeplus-2.0.0b2/test/test_env.py +25 -0
  6. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_external_stream.py +10 -1
  7. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_ingest_stream.py +36 -46
  8. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_query.py +16 -16
  9. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_sink.py +2 -1
  10. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_source.py +2 -0
  11. timeplus-2.0.0b2/test/test_sqlalchemy_query.py +160 -0
  12. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/dbapi.py +40 -8
  13. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/env.py +26 -0
  14. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/stream.py +14 -0
  15. timeplus-2.0.0b2/timeplus/version.py +1 -0
  16. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus.egg-info/PKG-INFO +1 -1
  17. timeplus-1.4.1/test/test_env.py +0 -41
  18. timeplus-1.4.1/test/test_sqlalchemy_query.py +0 -120
  19. timeplus-1.4.1/timeplus/version.py +0 -1
  20. {timeplus-1.4.1 → timeplus-2.0.0b2}/README.md +0 -0
  21. {timeplus-1.4.1 → timeplus-2.0.0b2}/setup.cfg +0 -0
  22. {timeplus-1.4.1 → timeplus-2.0.0b2}/setup.py +0 -0
  23. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/__init__.py +0 -0
  24. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/configuration.py +0 -0
  25. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/__init__.py +0 -0
  26. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/alert.py +0 -0
  27. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/alert_incident.py +0 -0
  28. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/alert_timeline.py +0 -0
  29. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/analyze_sql_request.py +0 -0
  30. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/api_key.py +0 -0
  31. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/batching_policy.py +0 -0
  32. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/build.py +0 -0
  33. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/column.py +0 -0
  34. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/column_def.py +0 -0
  35. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/columns_resp.py +0 -0
  36. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_alert_request.py +0 -0
  37. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_api_key_request.py +0 -0
  38. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_api_key_response.py +0 -0
  39. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_dashboard_request.py +0 -0
  40. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_query_request_v1_beta2.py +0 -0
  41. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_saved_query_request.py +0 -0
  42. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_sink_request.py +0 -0
  43. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_source_request.py +0 -0
  44. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/create_view_request.py +0 -0
  45. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/customer.py +0 -0
  46. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/dashboard_dashboard.py +0 -0
  47. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/dashboard_panel.py +0 -0
  48. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/edge.py +0 -0
  49. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/error_response.py +0 -0
  50. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/event.py +0 -0
  51. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/event_infer_request.py +0 -0
  52. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/event_infer_response.py +0 -0
  53. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/execute_query_request.py +0 -0
  54. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/external_stream.py +0 -0
  55. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/external_stream_def.py +0 -0
  56. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/external_table.py +0 -0
  57. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/external_table_def.py +0 -0
  58. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/format_query_request.py +0 -0
  59. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/format_query_response.py +0 -0
  60. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/global_metrics_result.py +0 -0
  61. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/graph.py +0 -0
  62. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/info.py +0 -0
  63. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/ingest_data.py +0 -0
  64. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/invitation.py +0 -0
  65. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/invitation_request.py +0 -0
  66. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/kafka_common.py +0 -0
  67. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/kafka_common_tls.py +0 -0
  68. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/keygen_license.py +0 -0
  69. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/license_license.py +0 -0
  70. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/node.py +0 -0
  71. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/owner.py +0 -0
  72. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/payment.py +0 -0
  73. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query.py +0 -0
  74. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query_pipeline.py +0 -0
  75. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query_pipeline_edge.py +0 -0
  76. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query_pipeline_node.py +0 -0
  77. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query_pipeline_node_metric.py +0 -0
  78. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/query_result.py +0 -0
  79. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/saved_query.py +0 -0
  80. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/schema_resp.py +0 -0
  81. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/sink.py +0 -0
  82. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/sink_stat.py +0 -0
  83. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/sink_stats.py +0 -0
  84. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/source.py +0 -0
  85. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/source_preview_request.py +0 -0
  86. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/sql_analyze_column.py +0 -0
  87. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/sql_analyze_result.py +0 -0
  88. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stats.py +0 -0
  89. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stats_error.py +0 -0
  90. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stats_throughput.py +0 -0
  91. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stream.py +0 -0
  92. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stream_def.py +0 -0
  93. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stream_match_request.py +0 -0
  94. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stream_setting.py +0 -0
  95. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/stream_stats.py +0 -0
  96. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/subscription.py +0 -0
  97. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/time_columns.py +0 -0
  98. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/udf.py +0 -0
  99. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/udf_argument.py +0 -0
  100. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/udf_auth_context.py +0 -0
  101. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/update_dashboard_request.py +0 -0
  102. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/update_source_request.py +0 -0
  103. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/update_stream_request.py +0 -0
  104. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/update_view_request.py +0 -0
  105. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/update_workspace_request.py +0 -0
  106. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/v1beta2_create_schema_request.py +0 -0
  107. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/v1beta2_licenses_body.py +0 -0
  108. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/v1beta2_list_kafka_topic_request.py +0 -0
  109. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/v1beta2_update_schema_request.py +0 -0
  110. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/view.py +0 -0
  111. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/workspace.py +0 -0
  112. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/models/workspace_settings.py +0 -0
  113. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/rest.py +0 -0
  114. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/__init__.py +0 -0
  115. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/alerts_v1beta2_api.py +0 -0
  116. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/api_keys_v1beta2_api.py +0 -0
  117. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/dashboards_v1beta2_api.py +0 -0
  118. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/external_streams_v1beta2_api.py +0 -0
  119. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/external_tables_v1beta2_api.py +0 -0
  120. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/invitations_v1beta2_api.py +0 -0
  121. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/license_v1beta2_api.py +0 -0
  122. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/metrics_v1beta2_api.py +0 -0
  123. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/misc_api.py +0 -0
  124. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/queries_v1beta2_api.py +0 -0
  125. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/saved_queries_v1beta2_api.py +0 -0
  126. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/schemas_v1beta2_api.py +0 -0
  127. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/sinks_v1beta2_api.py +0 -0
  128. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/sources_v1beta2_api.py +0 -0
  129. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/streams_v1beta2_api.py +0 -0
  130. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/subscription_v1beta2_api.py +0 -0
  131. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/topology_v1beta2_api.py +0 -0
  132. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/udfs_v1beta2_api.py +0 -0
  133. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/views_v1beta2_api.py +0 -0
  134. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/workspace_v1beta2_api.py +0 -0
  135. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_client/timeplus/workspaces_v1beta2_api.py +0 -0
  136. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/__init__.py +0 -0
  137. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_alert.py +0 -0
  138. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_alert_incident.py +0 -0
  139. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_alert_timeline.py +0 -0
  140. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_alerts_v1beta2_api.py +0 -0
  141. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_analyze_sql_request.py +0 -0
  142. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_api_key.py +0 -0
  143. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_api_keys_v1beta2_api.py +0 -0
  144. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_batching_policy.py +0 -0
  145. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_build.py +0 -0
  146. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_column.py +0 -0
  147. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_column_def.py +0 -0
  148. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_columns_resp.py +0 -0
  149. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_alert_request.py +0 -0
  150. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_api_key_request.py +0 -0
  151. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_api_key_response.py +0 -0
  152. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_dashboard_request.py +0 -0
  153. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_query_request_v1_beta2.py +0 -0
  154. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_saved_query_request.py +0 -0
  155. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_sink_request.py +0 -0
  156. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_source_request.py +0 -0
  157. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_create_view_request.py +0 -0
  158. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_customer.py +0 -0
  159. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_dashboard_dashboard.py +0 -0
  160. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_dashboard_panel.py +0 -0
  161. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_dashboards_v1beta2_api.py +0 -0
  162. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_edge.py +0 -0
  163. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_error_response.py +0 -0
  164. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_event.py +0 -0
  165. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_event_infer_request.py +0 -0
  166. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_event_infer_response.py +0 -0
  167. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_execute_query_request.py +0 -0
  168. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_stream.py +0 -0
  169. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_stream_def.py +0 -0
  170. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_streams_v1beta2_api.py +0 -0
  171. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_table.py +0 -0
  172. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_table_def.py +0 -0
  173. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_external_tables_v1beta2_api.py +0 -0
  174. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_format_query_request.py +0 -0
  175. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_format_query_response.py +0 -0
  176. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_global_metrics_result.py +0 -0
  177. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_graph.py +0 -0
  178. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_info.py +0 -0
  179. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_ingest_data.py +0 -0
  180. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_invitation.py +0 -0
  181. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_invitation_request.py +0 -0
  182. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_invitations_v1beta2_api.py +0 -0
  183. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_kafka_common.py +0 -0
  184. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_kafka_common_tls.py +0 -0
  185. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_keygen_license.py +0 -0
  186. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_license_license.py +0 -0
  187. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_license_v1beta2_api.py +0 -0
  188. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_metrics_v1beta2_api.py +0 -0
  189. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_misc_api.py +0 -0
  190. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_node.py +0 -0
  191. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_owner.py +0 -0
  192. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_payment.py +0 -0
  193. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_queries_v1beta2_api.py +0 -0
  194. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query.py +0 -0
  195. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query_pipeline.py +0 -0
  196. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query_pipeline_edge.py +0 -0
  197. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query_pipeline_node.py +0 -0
  198. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query_pipeline_node_metric.py +0 -0
  199. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_query_result.py +0 -0
  200. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_saved_queries_v1beta2_api.py +0 -0
  201. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_saved_query.py +0 -0
  202. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_schema_resp.py +0 -0
  203. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_schemas_v1beta2_api.py +0 -0
  204. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sink.py +0 -0
  205. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sink_stat.py +0 -0
  206. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sink_stats.py +0 -0
  207. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sinks_v1beta2_api.py +0 -0
  208. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_source.py +0 -0
  209. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_source_preview_request.py +0 -0
  210. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sources_v1beta2_api.py +0 -0
  211. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sql_analyze_column.py +0 -0
  212. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_sql_analyze_result.py +0 -0
  213. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stats.py +0 -0
  214. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stats_error.py +0 -0
  215. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stats_throughput.py +0 -0
  216. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stream.py +0 -0
  217. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stream_def.py +0 -0
  218. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stream_match_request.py +0 -0
  219. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stream_setting.py +0 -0
  220. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_stream_stats.py +0 -0
  221. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_streams_v1beta2_api.py +0 -0
  222. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_subscription.py +0 -0
  223. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_subscription_v1beta2_api.py +0 -0
  224. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_time_columns.py +0 -0
  225. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_topology_v1beta2_api.py +0 -0
  226. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_udf.py +0 -0
  227. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_udf_argument.py +0 -0
  228. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_udf_auth_context.py +0 -0
  229. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_udfs_v1beta2_api.py +0 -0
  230. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_update_dashboard_request.py +0 -0
  231. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_update_source_request.py +0 -0
  232. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_update_stream_request.py +0 -0
  233. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_update_view_request.py +0 -0
  234. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_update_workspace_request.py +0 -0
  235. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_v1beta2_create_schema_request.py +0 -0
  236. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_v1beta2_licenses_body.py +0 -0
  237. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_v1beta2_list_kafka_topic_request.py +0 -0
  238. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_v1beta2_update_schema_request.py +0 -0
  239. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_view.py +0 -0
  240. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_views_v1beta2_api.py +0 -0
  241. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_workspace.py +0 -0
  242. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_workspace_settings.py +0 -0
  243. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_workspace_v1beta2_api.py +0 -0
  244. {timeplus-1.4.1 → timeplus-2.0.0b2}/swagger_test/test_workspaces_v1beta2_api.py +0 -0
  245. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_alert.py +0 -0
  246. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_dashboard.py +0 -0
  247. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_schema.py +0 -0
  248. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_sqlalchemy_types.py +0 -0
  249. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_stream.py +0 -0
  250. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_topology.py +0 -0
  251. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_udf.py +0 -0
  252. {timeplus-1.4.1 → timeplus-2.0.0b2}/test/test_view.py +0 -0
  253. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/__init__.py +0 -0
  254. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/alert.py +0 -0
  255. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/dashboard.py +0 -0
  256. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/error.py +0 -0
  257. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/external_stream.py +0 -0
  258. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/query.py +0 -0
  259. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/schema.py +0 -0
  260. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/sink.py +0 -0
  261. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/source.py +0 -0
  262. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/sqlalchemy.py +0 -0
  263. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/topology.py +0 -0
  264. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/type.py +0 -0
  265. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/udf.py +0 -0
  266. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus/view.py +0 -0
  267. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus.egg-info/SOURCES.txt +0 -0
  268. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus.egg-info/dependency_links.txt +0 -0
  269. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus.egg-info/requires.txt +0 -0
  270. {timeplus-1.4.1 → timeplus-2.0.0b2}/timeplus.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timeplus
3
- Version: 1.4.1
3
+ Version: 2.0.0b2
4
4
  Summary: Timeplus python SDK
5
5
  Home-page: https://github.com/timeplus-io/gluon/tree/develop/python
6
6
  Author: Gang Tao
@@ -17,6 +17,7 @@ from multiprocessing.pool import ThreadPool
17
17
  import os
18
18
  import re
19
19
  import tempfile
20
+ import base64
20
21
 
21
22
  # python 2 and python 3 compatibility library
22
23
  import six
@@ -75,7 +76,10 @@ class ApiClient(object):
75
76
  self.user_agent = 'Swagger-Codegen/1.0.0/python'
76
77
 
77
78
  def __del__(self):
78
- self.pool.close()
79
+ try: # TODO: skip close exection
80
+ self.pool.close()
81
+ except Exception:
82
+ pass
79
83
  self.pool.join()
80
84
 
81
85
  @property
@@ -134,6 +138,10 @@ class ApiClient(object):
134
138
  post_params = self.parameters_to_tuples(post_params,
135
139
  collection_formats)
136
140
 
141
+ if self.configuration.username and self.configuration.password:
142
+ auth_header = f"{self.configuration.username}:{self.configuration.password}"
143
+ header_params['Authorization'] = 'Basic ' + base64.b64encode(auth_header.encode()).decode()
144
+
137
145
  # auth setting
138
146
  self.update_params_for_auth(header_params, query_params, auth_settings)
139
147
 
@@ -312,6 +320,7 @@ class ApiClient(object):
312
320
  If parameter async_req is False or missing,
313
321
  then the method will return the response directly.
314
322
  """
323
+
315
324
  if not async_req:
316
325
  return self.__call_api(resource_path, method,
317
326
  path_params, query_params, header_params,
@@ -1,10 +1,10 @@
1
1
  from timeplus import Query
2
2
 
3
3
 
4
- def test_analyze(test_environment):
4
+ def test_analyze(test_environment, test_stream):
5
5
  result = (
6
6
  Query(env=test_environment)
7
- .sql(query=f"SELECT * FROM car_live_data")
7
+ .sql(query=f"SELECT * FROM test_stream")
8
8
  .analyze()
9
9
  )
10
10
 
@@ -1,34 +1,31 @@
1
- def test_dbapi_table(conn):
2
- cursor = conn.execute("select * from table(car_live_data)")
1
+ def test_dbapi_table(conn, test_stream):
2
+ cursor = conn.execute("select * from table(test_stream)")
3
3
  next_result = cursor.next()
4
4
  row1 = cursor.fetchone()
5
- rows = cursor.fetchmany(3)
6
- cursor_2 = conn.execute("select 1<>2")
7
- query_result = list(cursor_2)
8
-
9
5
  assert next_result is not None
10
6
  assert row1 is not None
11
- assert len(rows) == 3
7
+
8
+ rows = cursor.fetchmany(2)
9
+ assert len(rows) == 2
10
+
11
+ cursor_2 = conn.execute("select 1<>2")
12
+ query_result = list(cursor_2)
12
13
  assert len(query_result) == 1
13
14
 
14
15
 
15
- def test_dbapi_live(conn):
16
- cursor = conn.execute("select * from car_live_data")
16
+ def test_dbapi_live(conn, test_stream):
17
+ cursor = conn.execute("select * from test_stream where _tp_time > earliest_ts()")
17
18
  next_result = cursor.next()
18
19
  row1 = cursor.fetchone()
19
- rows = cursor.fetchmany(3)
20
- cursor_2 = conn.execute("select 1<>2")
21
- query_result = list(cursor_2)
20
+ rows = cursor.fetchmany(2)
22
21
 
23
22
  assert next_result is not None
24
23
  assert row1 is not None
25
- assert len(rows) == 3
26
- assert len(query_result) == 1
24
+ assert len(rows) == 2
27
25
 
28
26
 
29
- def test_dbapi_show_streams(conn):
27
+ def test_dbapi_show_streams(conn, test_stream):
30
28
  cursor = conn.execute("show streams")
31
- cursor.next()
32
29
  row = cursor.fetchone()
33
30
 
34
31
  assert row is not None
@@ -0,0 +1,25 @@
1
+ import os
2
+ import re
3
+
4
+ import pytest
5
+ from timeplus.env import Environment
6
+ WORKSPACE_LEN = 8
7
+ APIKEY_LEN = 60
8
+
9
+
10
+ def test_apikey_with_valid_key(test_environment):
11
+ env = test_environment
12
+ if os.environ.get("TIMEPLUS_API_KEY") is not None:
13
+ assert env._configuration.api_key["X-Api-Key"] == os.environ.get("TIMEPLUS_API_KEY")
14
+
15
+
16
+ def test_apikey_with_invalid_key():
17
+ if os.environ.get("TIMEPLUS_API_KEY") is not None:
18
+ env = Environment()
19
+ with pytest.raises(ValueError, match=f"The apikey should be {APIKEY_LEN} characters"):
20
+ env.apikey("invalid_key")
21
+
22
+
23
+ def test_workspace_with_valid_name(test_environment):
24
+ env = test_environment
25
+ assert env._workspace == os.environ.get("TIMEPLUS_WORKSPACE")
@@ -1,9 +1,12 @@
1
+ import os
1
2
  from timeplus import ExternalStream
2
3
 
3
4
 
4
5
  def test_external_stream(test_environment):
5
6
  name = "gluon_test_external_name"
6
7
 
8
+ external_stream_password = os.environ.get("EXTERNAL_STREAM_PASSWORD")
9
+
7
10
  # Create a new stream instance with the given name
8
11
  stream = ExternalStream(env=test_environment).name(name)
9
12
 
@@ -19,7 +22,13 @@ def test_external_stream(test_environment):
19
22
  .name(name)
20
23
  .add_column("raw", "string")
21
24
  .add_settings("type", "kafka")
22
- .add_settings("brokers", "kafka.demo-internal:9092")
25
+ .add_settings("brokers", "kafka-public-read-timeplus.a.aivencloud.com:28864")
26
+ .add_settings("security_protocol", "SASL_SSL")
27
+ .add_settings("sasl_mechanism", "SCRAM-SHA-256")
28
+ .add_settings("username", "readonly")
29
+ .add_settings("password", external_stream_password)
30
+ .add_settings("skip_ssl_cert_check", "1")
31
+
23
32
  .add_settings("topic", "car_live_data")
24
33
  .create()
25
34
  )
@@ -1,19 +1,25 @@
1
1
  import json
2
2
  import time
3
-
3
+ import os
4
4
  import pytest
5
+
5
6
  from timeplus import Stream, Query
6
7
  import datetime
7
8
 
9
+ time_wait = 5
10
+
8
11
 
9
12
  def test_ingest(test_environment, test_stream):
13
+ # there is 4 row data in test stream already
14
+ time.sleep(time_wait)
15
+ # wait previous data ingested
10
16
  data = [["time", "data"], [[1, "efgh"]]]
11
17
  try:
12
18
  test_stream.ingest(*data)
13
19
  except Exception as e:
14
20
  pytest.fail(f"Ingest method failed with exception {e}")
15
21
 
16
- time.sleep(3)
22
+ time.sleep(time_wait)
17
23
 
18
24
  query = (
19
25
  Query(env=test_environment)
@@ -25,96 +31,80 @@ def test_ingest(test_environment, test_stream):
25
31
  for event in query.result():
26
32
  if event.event == "message":
27
33
  results.extend(json.loads(event.data))
28
- print(results)
29
- print(results[1][1])
30
34
 
35
+ result_length = len(results)
31
36
  assert len(results) > 1, "No data returned from the stream"
32
- assert results[1][0] == 1, "Returned time does not match the ingested integer"
33
- assert results[1][1] == 'efgh', "Returned data does not match the ingested string"
37
+ assert results[result_length-1][0] == 1, "Returned time does not match the ingested integer"
38
+ assert results[result_length-1][1] == 'efgh', "Returned data does not match the ingested string"
34
39
 
35
40
  query.delete()
36
41
 
37
42
 
38
- def test_stream_ingest_lines(test_environment,test_stream):
39
- test_stream.delete()
43
+ def test_stream_ingest_lines(test_environment, test_stream_raw):
40
44
 
41
- stream = (
42
- Stream(env=test_environment)
43
- .name("test_stream")
44
- .column("raw", "string")
45
- .create()
46
- )
47
45
  payload = '{"time":1,"data":"abcd"}\n{"time":2,"data":"xyz"}'
48
46
 
49
47
  # Ingest data in 'lines' format
50
48
  try:
51
- stream.ingest(payload=payload, format="lines")
49
+ test_stream_raw.ingest(payload=payload, format="lines")
52
50
  except Exception as e:
53
51
  pytest.fail(f"Ingest lines method failed with exception {e}")
54
52
 
55
- time.sleep(3)
53
+ time.sleep(time_wait)
56
54
 
57
55
  query = (
58
56
  Query(env=test_environment)
59
- .sql(query="SELECT * FROM table(test_stream)")
57
+ .sql(query="SELECT * FROM table(test_stream_raw)")
60
58
  .create()
61
59
  )
62
60
  results = []
63
61
  for event in query.result():
64
62
  if event.event == "message":
65
63
  results.extend(json.loads(event.data))
66
- print(results)
67
- print(results[0][0])
64
+
65
+ result_length = len(results)
68
66
 
69
67
  assert len(results) > 1, "No data returned from the stream"
70
- assert results[0][0] == '{"time":1,"data":"abcd"}', "Returned data does not match the ingested data"
71
- assert results[1][0] == '{"time":2,"data":"xyz"}', "Returned data does not match the ingested data"
68
+ assert results[result_length-2][0] == '{"time":1,"data":"abcd"}', "Returned data does not match the ingested data"
69
+ assert results[result_length-1][0] == '{"time":2,"data":"xyz"}', "Returned data does not match the ingested data"
72
70
 
73
71
  query.delete()
74
72
 
75
-
76
- def test_stream_ingest_raw(test_environment,test_stream):
77
- test_stream.delete()
78
-
73
+ def test_stream_ingest_raw(test_environment, test_stream_raw):
79
74
  payload = """
80
75
  {"a":1,"b":"world"}
81
76
  {"a":2,"b":"hello"}
82
77
  """
83
78
 
84
- stream = (
85
- Stream(env=test_environment)
86
- .name("test_stream")
87
- .column("raw", "string")
88
- .create()
89
- )
90
-
91
79
  # Ingest data in 'raw' format
92
80
  try:
93
- stream.ingest(payload=payload, format="raw")
81
+ test_stream_raw.ingest(payload=payload, format="raw")
94
82
  except Exception as e:
95
83
  pytest.fail(f"Ingest raw method failed with exception {e}")
96
84
 
97
- time.sleep(3)
85
+ time.sleep(time_wait)
98
86
 
99
87
  query = (
100
88
  Query(env=test_environment)
101
- .sql(query="SELECT * FROM table(test_stream)")
89
+ .sql(query="SELECT * FROM table(test_stream_raw)")
102
90
  .create()
103
91
  )
104
92
  results = []
105
93
  for event in query.result():
106
94
  if event.event == "message":
107
95
  results.extend(json.loads(event.data))
108
- print(results)
109
- print(results[0][0])
110
-
96
+
97
+ result_length = len(results)
111
98
  assert results is not None, "No data returned from the stream"
112
- assert results[0][0] == payload, "Returned data does not match the ingested data"
99
+ assert results[result_length-1][0] == payload, "Returned data does not match the ingested data"
113
100
 
114
101
  query.delete()
115
102
 
116
103
 
117
104
  def test_json_ingest(test_environment, test_stream):
105
+ # there is 4 row data in test stream already
106
+ time.sleep(time_wait)
107
+ # wait previous data ingested
118
108
  payload = """
119
109
  {"time":2,"data":"hello"}
120
110
  {"time":1,"data":"world"}
@@ -126,7 +116,7 @@ def test_json_ingest(test_environment, test_stream):
126
116
  except Exception as e:
127
117
  pytest.fail(f"Ingest streaming method failed with exception {e}")
128
118
 
129
- time.sleep(3)
119
+ time.sleep(time_wait)
130
120
 
131
121
  query = (
132
122
  Query(env=test_environment)
@@ -137,14 +127,14 @@ def test_json_ingest(test_environment, test_stream):
137
127
  for event in query.result():
138
128
  if event.event == "message":
139
129
  results.extend(json.loads(event.data))
130
+
140
131
  print(results)
141
- print(results[0][0])
142
- print(results[0])
143
132
 
133
+ result_length = len(results)
144
134
  assert len(results) > 1, "No data returned from the stream"
145
- assert results[1][0] == 2, "Returned data does not match the ingested data"
146
- assert results[1][1] == 'hello', "Returned data does not match the ingested data"
147
- assert results[2][0] == 1, "Returned data does not match the ingested data"
148
- assert results[2][1] == 'world', "Returned data does not match the ingested data"
135
+ assert results[result_length-2][0] == 2, "Returned data does not match the ingested data"
136
+ assert results[result_length-2][1] == 'hello', "Returned data does not match the ingested data"
137
+ assert results[result_length-1][0] == 1, "Returned data does not match the ingested data"
138
+ assert results[result_length-1][1] == 'world', "Returned data does not match the ingested data"
149
139
 
150
140
  query.delete()
@@ -8,7 +8,7 @@ def test_query_with_stream(test_environment, test_stream):
8
8
  # Test the Query object with stream
9
9
  query = (
10
10
  Query(env=test_environment)
11
- .sql(query=f"SELECT * FROM test_stream")
11
+ .sql(query=f"SELECT * FROM test_stream where _tp_time > earliest_ts()")
12
12
  .create()
13
13
  )
14
14
 
@@ -22,6 +22,19 @@ def test_query_with_stream(test_environment, test_stream):
22
22
  assert "sql" in metadata
23
23
  assert "id" in metadata
24
24
 
25
+ limit = 1
26
+ count = 0
27
+
28
+ results = []
29
+ for event in query.result():
30
+ if event.event == "message":
31
+ results.extend(json.loads(event.data))
32
+ count += 1
33
+ if count >= limit:
34
+ break
35
+
36
+ assert len(results) >= 4 # there are records from ingest test
37
+
25
38
  query.cancel()
26
39
  # Without query.cancel(), there will be an error:
27
40
  # OSError: [Errno 9] Bad file descriptor And the query cannot be deleted
@@ -32,30 +45,17 @@ def test_query_with_stream(test_environment, test_stream):
32
45
 
33
46
 
34
47
  def test_query_with_table(test_environment, test_stream):
35
- #Test the Query Object with history table
36
- data = [["time", "data"], [[1, "efgh"]]]
37
- test_stream.ingest(*data)
38
-
39
48
  time.sleep(3)
40
- # Without sleep(3), there will be an error:
41
- # FAILED test_query.py::test_query_with_table - KeyError: 'id'
42
-
49
+
43
50
  query = (
44
51
  Query(env=test_environment)
45
52
  .sql(query="SELECT * FROM table(test_stream)")
46
53
  .create()
47
54
  )
48
55
 
49
- limit = 2
50
- count = 0
51
-
52
56
  results = []
53
57
  for event in query.result():
54
58
  if event.event == "message":
55
59
  results.extend(json.loads(event.data))
56
- count += 1
57
- if count >= limit:
58
- break
59
- print(results)
60
- assert len(results) == 2
60
+ assert len(results) >= 4 # there are records from ingest test
61
61
  query.delete()
@@ -1,6 +1,7 @@
1
+ import pytest
1
2
  from timeplus import Sink
2
3
 
3
-
4
+ @pytest.mark.skipif(reason="Skipping this test due to kafka sink move to external stream")
4
5
  def test_sink_kafka(test_environment):
5
6
  sink_name = "test_kafka_sink"
6
7
 
@@ -1,3 +1,4 @@
1
+ import pytest
1
2
  from timeplus import Source, Stream
2
3
 
3
4
 
@@ -50,6 +51,7 @@ def test_source_generator(test_environment):
50
51
  assert not Source(env=test_environment).id(source_id).exist()
51
52
 
52
53
 
54
+ @pytest.mark.skipif(reason="Skipping this test due to kafka source move to external stream")
53
55
  def test_source_kafka(test_environment):
54
56
  stream_name = "test_kafka"
55
57
  source_name = "test_kafka"
@@ -0,0 +1,160 @@
1
+ import time
2
+ import pytest
3
+ from sqlalchemy import text, select, MetaData, Table
4
+ from datetime import timedelta
5
+ from timeplus import View
6
+
7
+
8
+ def test_driver_sql(engine, test_stream):
9
+ with engine.connect() as conn:
10
+ result = conn.exec_driver_sql(
11
+ "select * from table(test_stream) limit 2")
12
+ assert len(result.fetchall()) == 2
13
+
14
+
15
+ def test_driver_sql_live(engine, test_stream):
16
+ with engine.connect() as conn:
17
+ result = conn.exec_driver_sql(
18
+ "select * from test_stream where _tp_time > earliest_ts() limit 2")
19
+ assert len(result.fetchall()) == 2
20
+
21
+ def test_text_sql(engine, test_stream):
22
+ with engine.connect() as connection:
23
+ result = connection.execute(
24
+ text("select * from table(test_stream) limit 3"))
25
+ rows = [row for row in result]
26
+ assert len(rows) == 3
27
+
28
+ def test_text_sql_live(engine, test_stream):
29
+ with engine.connect() as connection:
30
+ result = connection.execute(
31
+ text("select * from test_stream where _tp_time > earliest_ts() limit 3"))
32
+ rows = [row for row in result]
33
+ assert len(rows) == 3
34
+
35
+ def test_text_streaming_sql(engine, test_stream):
36
+ with engine.connect() as connection:
37
+ result = connection.execute(text("select * from test_stream where _tp_time > earliest_ts()"))
38
+ count = 0
39
+ max = 3
40
+ for row in result:
41
+ assert row is not None
42
+ count += 1
43
+ if count >= max:
44
+ break
45
+ assert count == max
46
+
47
+ def test_check_stream_existence(engine, test_stream):
48
+ table_name = "test_stream"
49
+ with engine.connect() as conn:
50
+ table_exists = engine.dialect.has_table(conn, table_name)
51
+ assert table_exists
52
+
53
+ def test_table_names(engine, test_stream):
54
+ with engine.connect() as conn:
55
+ tables = engine.dialect.get_table_names(conn)
56
+ assert "test_stream" in tables
57
+
58
+ def test_view_names(test_environment, engine, test_stream):
59
+ view_name = "example_mv"
60
+ view = View(env=test_environment).name(view_name)
61
+
62
+ try:
63
+ view.delete()
64
+ except Exception:
65
+ pass
66
+
67
+ view = (
68
+ View(env=test_environment)
69
+ .name(view_name)
70
+ .query("select * from test_stream")
71
+ .create()
72
+ )
73
+
74
+ time.sleep(1)
75
+
76
+ with engine.connect() as conn:
77
+ views = engine.dialect.get_view_names(conn)
78
+ print(views)
79
+ assert "example_mv" in views
80
+
81
+ view.delete()
82
+
83
+ def test_materialized_view_names(engine,test_environment,test_stream):
84
+ view_name = "example_mv"
85
+ view = View(env=test_environment).name(view_name)
86
+
87
+ try:
88
+ view.delete()
89
+ except Exception:
90
+ pass
91
+
92
+ view = (
93
+ View(env=test_environment)
94
+ .name(view_name)
95
+ .query("select * from test_stream")
96
+ .materialized(True)
97
+ .create()
98
+ )
99
+
100
+ with engine.connect() as conn:
101
+ mvs = engine.dialect.get_materialized_view_names(conn)
102
+ assert "example_mv" in mvs
103
+
104
+ view.delete()
105
+
106
+ def test_view_reflection(test_environment, engine, test_stream):
107
+ view_name = "test_view"
108
+ view = View(env=test_environment).name(view_name)
109
+
110
+ try:
111
+ view.delete()
112
+ except Exception:
113
+ pass
114
+
115
+ view = (
116
+ View(env=test_environment)
117
+ .name(view_name)
118
+ .query("select * from test_stream")
119
+ .create()
120
+ )
121
+
122
+ time.sleep(1)
123
+ metadata_obj = MetaData()
124
+ test_view = Table("test_view", metadata_obj, autoload_with=engine)
125
+ assert test_view is not None
126
+ column_names = [c.name for c in test_view.columns]
127
+ assert "time" in column_names
128
+ assert "data" in column_names
129
+
130
+ view.delete()
131
+ time.sleep(3)
132
+
133
+ def test_table_reflection(engine, test_stream):
134
+ metadata_obj = MetaData()
135
+ test_table = Table("test_stream", metadata_obj, autoload_with=engine)
136
+ assert test_table is not None
137
+ column_names = [c.name for c in test_table.columns]
138
+ assert "time" in column_names
139
+ assert "data" in column_names
140
+
141
+ def test_select_query(engine, test_stream):
142
+ metadata_obj = MetaData()
143
+ test_table = Table("test_stream", metadata_obj, autoload_with=engine)
144
+ one_hour_ago = text("now() - 1h")
145
+ stmt = select(test_table).where(
146
+ test_table.c._tp_time > one_hour_ago,
147
+ test_table.c.time > 1
148
+ )
149
+ compiled_query = stmt.compile(compile_kwargs={"literal_binds": True})
150
+ print(f"compiled_query {compiled_query}")
151
+
152
+ with engine.connect() as conn:
153
+ count = 0
154
+ max = 2
155
+ for row in conn.execute(stmt):
156
+ assert row is not None
157
+ count += 1
158
+ if count >= max:
159
+ break
160
+ assert count == max
@@ -1,9 +1,10 @@
1
+ import os
1
2
  import json
2
3
  import re
3
4
  import itertools
4
5
  from collections import namedtuple
5
6
 
6
- from timeplus import Environment, Query, Stream, View
7
+ from timeplus import Environment, Query, Stream, View, ExternalStream
7
8
  from timeplus.error import Error
8
9
 
9
10
 
@@ -84,16 +85,24 @@ def connect(
84
85
  Connection: A Connection object.
85
86
  """
86
87
  address = f"{scheme}://{host}:{port}"
87
- apikey = password
88
88
  workspace = path
89
- return Connection(address, apikey, workspace)
89
+ if user is not None and password is not None:
90
+ return Connection(address, None, workspace, user, password)
91
+ else:
92
+ apikey = password
93
+ return Connection(address, apikey, workspace, None, None)
90
94
 
91
95
 
92
96
  class Connection(object):
93
97
  """Connection to a Timeplus workspace."""
94
98
 
95
99
  def __init__(
96
- self, address="https://us.timeplus.cloud", apikey=None, workspace=None
100
+ self,
101
+ address="https://us.timeplus.cloud",
102
+ apikey=None,
103
+ workspace=None,
104
+ username=None,
105
+ password=None,
97
106
  ):
98
107
  """
99
108
  Constructor for the Connection class.
@@ -102,8 +111,24 @@ class Connection(object):
102
111
  address: String - Server address. Default is "https://us.timeplus.cloud".
103
112
  apikey: String - API key for the connection. Default is None.
104
113
  workspace: String - Workspace for the connection. Default is None.
114
+ username: String - username for the connection. Default is None.
115
+ password: String - password for the connection. Default is None.
105
116
  """
106
- self.env = Environment().address(address).workspace(workspace).apikey(apikey)
117
+
118
+ if os.environ.get("TIMEPLUS_SQLALCHEMY_SCHEMA") == "http":
119
+ address = address.replace("https://", "http://")
120
+
121
+ self.env = Environment().address(address).workspace(workspace)
122
+
123
+ if apikey is not None:
124
+ self.env.apikey(apikey)
125
+
126
+ if username is not None:
127
+ self.env.username(username)
128
+
129
+ if password is not None:
130
+ self.env.password(password)
131
+
107
132
  self.closed = False
108
133
  self.cursors = []
109
134
 
@@ -151,20 +176,27 @@ class Connection(object):
151
176
  # since some SQL is not exposed through API yet
152
177
  def _exist_table(self, name):
153
178
  stream = Stream(env=self.env).name(name)
154
- return stream.exist()
179
+ external_stream = ExternalStream(env=self.env).name(name)
180
+ return stream.exist() or external_stream.exist()
155
181
 
156
182
  def _exist_view(self, name):
157
183
  view = View(env=self.env).name(name)
158
184
  return view.exist()
159
185
 
160
186
  def _get_table(self, name):
161
- return Stream(env=self.env).name(name).get()
187
+ try:
188
+ return Stream(env=self.env).name(name).get()
189
+ except: # noqa: E722
190
+ return ExternalStream(env=self.env).name(name).get()
162
191
 
163
192
  def _get_view(self, name):
164
193
  return View(env=self.env).name(name).get()
165
194
 
166
195
  def _list_table(self):
167
- return Stream(env=self.env).list()
196
+ streams = Stream(env=self.env).list()
197
+ estreams = ExternalStream(env=self.env).list()
198
+
199
+ return streams + estreams
168
200
 
169
201
  def _list_view(self):
170
202
  return View(env=self.env).list()