timeplus 2.0.0b1__tar.gz → 2.0.0b3__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 (269) hide show
  1. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/PKG-INFO +1 -1
  2. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/api_client.py +10 -1
  3. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stream.py +1 -1
  4. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_analyze.py +2 -2
  5. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_dbapi.py +13 -16
  6. timeplus-2.0.0b3/test/test_env.py +25 -0
  7. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_external_stream.py +10 -1
  8. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_ingest_stream.py +27 -49
  9. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_query.py +16 -16
  10. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_sink.py +2 -1
  11. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_source.py +2 -0
  12. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_sqlalchemy_query.py +60 -40
  13. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/dbapi.py +31 -6
  14. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/env.py +26 -0
  15. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/stream.py +3 -2
  16. timeplus-2.0.0b3/timeplus/version.py +1 -0
  17. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus.egg-info/PKG-INFO +1 -1
  18. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus.egg-info/SOURCES.txt +241 -0
  19. timeplus-2.0.0b1/test/test_env.py +0 -41
  20. timeplus-2.0.0b1/timeplus/version.py +0 -1
  21. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/README.md +0 -0
  22. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/setup.cfg +0 -0
  23. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/setup.py +0 -0
  24. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/__init__.py +0 -0
  25. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/configuration.py +0 -0
  26. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/__init__.py +0 -0
  27. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/alert.py +0 -0
  28. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/alert_incident.py +0 -0
  29. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/alert_timeline.py +0 -0
  30. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/analyze_sql_request.py +0 -0
  31. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/api_key.py +0 -0
  32. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/batching_policy.py +0 -0
  33. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/build.py +0 -0
  34. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/column.py +0 -0
  35. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/column_def.py +0 -0
  36. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/columns_resp.py +0 -0
  37. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_alert_request.py +0 -0
  38. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_api_key_request.py +0 -0
  39. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_api_key_response.py +0 -0
  40. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_dashboard_request.py +0 -0
  41. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_query_request_v1_beta2.py +0 -0
  42. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_saved_query_request.py +0 -0
  43. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_sink_request.py +0 -0
  44. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_source_request.py +0 -0
  45. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/create_view_request.py +0 -0
  46. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/customer.py +0 -0
  47. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/dashboard_dashboard.py +0 -0
  48. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/dashboard_panel.py +0 -0
  49. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/edge.py +0 -0
  50. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/error_response.py +0 -0
  51. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/event.py +0 -0
  52. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/event_infer_request.py +0 -0
  53. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/event_infer_response.py +0 -0
  54. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/execute_query_request.py +0 -0
  55. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/external_stream.py +0 -0
  56. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/external_stream_def.py +0 -0
  57. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/external_table.py +0 -0
  58. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/external_table_def.py +0 -0
  59. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/format_query_request.py +0 -0
  60. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/format_query_response.py +0 -0
  61. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/global_metrics_result.py +0 -0
  62. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/graph.py +0 -0
  63. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/info.py +0 -0
  64. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/ingest_data.py +0 -0
  65. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/invitation.py +0 -0
  66. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/invitation_request.py +0 -0
  67. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/kafka_common.py +0 -0
  68. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/kafka_common_tls.py +0 -0
  69. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/keygen_license.py +0 -0
  70. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/license_license.py +0 -0
  71. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/node.py +0 -0
  72. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/owner.py +0 -0
  73. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/payment.py +0 -0
  74. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query.py +0 -0
  75. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query_pipeline.py +0 -0
  76. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query_pipeline_edge.py +0 -0
  77. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query_pipeline_node.py +0 -0
  78. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query_pipeline_node_metric.py +0 -0
  79. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/query_result.py +0 -0
  80. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/saved_query.py +0 -0
  81. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/schema_resp.py +0 -0
  82. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/sink.py +0 -0
  83. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/sink_stat.py +0 -0
  84. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/sink_stats.py +0 -0
  85. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/source.py +0 -0
  86. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/source_preview_request.py +0 -0
  87. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/sql_analyze_column.py +0 -0
  88. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/sql_analyze_result.py +0 -0
  89. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stats.py +0 -0
  90. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stats_error.py +0 -0
  91. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stats_throughput.py +0 -0
  92. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stream_def.py +0 -0
  93. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stream_match_request.py +0 -0
  94. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stream_setting.py +0 -0
  95. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/stream_stats.py +0 -0
  96. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/subscription.py +0 -0
  97. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/time_columns.py +0 -0
  98. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/udf.py +0 -0
  99. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/udf_argument.py +0 -0
  100. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/udf_auth_context.py +0 -0
  101. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/update_dashboard_request.py +0 -0
  102. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/update_source_request.py +0 -0
  103. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/update_stream_request.py +0 -0
  104. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/update_view_request.py +0 -0
  105. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/update_workspace_request.py +0 -0
  106. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/v1beta2_create_schema_request.py +0 -0
  107. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/v1beta2_licenses_body.py +0 -0
  108. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/v1beta2_list_kafka_topic_request.py +0 -0
  109. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/v1beta2_update_schema_request.py +0 -0
  110. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/view.py +0 -0
  111. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/workspace.py +0 -0
  112. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/models/workspace_settings.py +0 -0
  113. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/rest.py +0 -0
  114. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/__init__.py +0 -0
  115. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/alerts_v1beta2_api.py +0 -0
  116. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/api_keys_v1beta2_api.py +0 -0
  117. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/dashboards_v1beta2_api.py +0 -0
  118. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/external_streams_v1beta2_api.py +0 -0
  119. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/external_tables_v1beta2_api.py +0 -0
  120. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/invitations_v1beta2_api.py +0 -0
  121. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/license_v1beta2_api.py +0 -0
  122. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/metrics_v1beta2_api.py +0 -0
  123. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/misc_api.py +0 -0
  124. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/queries_v1beta2_api.py +0 -0
  125. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/saved_queries_v1beta2_api.py +0 -0
  126. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/schemas_v1beta2_api.py +0 -0
  127. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/sinks_v1beta2_api.py +0 -0
  128. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/sources_v1beta2_api.py +0 -0
  129. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/streams_v1beta2_api.py +0 -0
  130. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/subscription_v1beta2_api.py +0 -0
  131. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/topology_v1beta2_api.py +0 -0
  132. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/udfs_v1beta2_api.py +0 -0
  133. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/views_v1beta2_api.py +0 -0
  134. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/workspace_v1beta2_api.py +0 -0
  135. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_client/timeplus/workspaces_v1beta2_api.py +0 -0
  136. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/__init__.py +0 -0
  137. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_alert.py +0 -0
  138. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_alert_incident.py +0 -0
  139. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_alert_timeline.py +0 -0
  140. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_alerts_v1beta2_api.py +0 -0
  141. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_analyze_sql_request.py +0 -0
  142. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_api_key.py +0 -0
  143. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_api_keys_v1beta2_api.py +0 -0
  144. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_batching_policy.py +0 -0
  145. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_build.py +0 -0
  146. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_column.py +0 -0
  147. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_column_def.py +0 -0
  148. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_columns_resp.py +0 -0
  149. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_alert_request.py +0 -0
  150. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_api_key_request.py +0 -0
  151. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_api_key_response.py +0 -0
  152. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_dashboard_request.py +0 -0
  153. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_query_request_v1_beta2.py +0 -0
  154. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_saved_query_request.py +0 -0
  155. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_sink_request.py +0 -0
  156. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_source_request.py +0 -0
  157. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_create_view_request.py +0 -0
  158. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_customer.py +0 -0
  159. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_dashboard_dashboard.py +0 -0
  160. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_dashboard_panel.py +0 -0
  161. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_dashboards_v1beta2_api.py +0 -0
  162. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_edge.py +0 -0
  163. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_error_response.py +0 -0
  164. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_event.py +0 -0
  165. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_event_infer_request.py +0 -0
  166. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_event_infer_response.py +0 -0
  167. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_execute_query_request.py +0 -0
  168. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_stream.py +0 -0
  169. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_stream_def.py +0 -0
  170. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_streams_v1beta2_api.py +0 -0
  171. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_table.py +0 -0
  172. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_table_def.py +0 -0
  173. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_external_tables_v1beta2_api.py +0 -0
  174. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_format_query_request.py +0 -0
  175. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_format_query_response.py +0 -0
  176. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_global_metrics_result.py +0 -0
  177. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_graph.py +0 -0
  178. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_info.py +0 -0
  179. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_ingest_data.py +0 -0
  180. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_invitation.py +0 -0
  181. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_invitation_request.py +0 -0
  182. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_invitations_v1beta2_api.py +0 -0
  183. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_kafka_common.py +0 -0
  184. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_kafka_common_tls.py +0 -0
  185. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_keygen_license.py +0 -0
  186. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_license_license.py +0 -0
  187. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_license_v1beta2_api.py +0 -0
  188. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_metrics_v1beta2_api.py +0 -0
  189. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_misc_api.py +0 -0
  190. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_node.py +0 -0
  191. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_owner.py +0 -0
  192. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_payment.py +0 -0
  193. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_queries_v1beta2_api.py +0 -0
  194. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query.py +0 -0
  195. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query_pipeline.py +0 -0
  196. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query_pipeline_edge.py +0 -0
  197. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query_pipeline_node.py +0 -0
  198. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query_pipeline_node_metric.py +0 -0
  199. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_query_result.py +0 -0
  200. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_saved_queries_v1beta2_api.py +0 -0
  201. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_saved_query.py +0 -0
  202. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_schema_resp.py +0 -0
  203. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_schemas_v1beta2_api.py +0 -0
  204. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sink.py +0 -0
  205. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sink_stat.py +0 -0
  206. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sink_stats.py +0 -0
  207. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sinks_v1beta2_api.py +0 -0
  208. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_source.py +0 -0
  209. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_source_preview_request.py +0 -0
  210. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sources_v1beta2_api.py +0 -0
  211. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sql_analyze_column.py +0 -0
  212. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_sql_analyze_result.py +0 -0
  213. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stats.py +0 -0
  214. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stats_error.py +0 -0
  215. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stats_throughput.py +0 -0
  216. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stream.py +0 -0
  217. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stream_def.py +0 -0
  218. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stream_match_request.py +0 -0
  219. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stream_setting.py +0 -0
  220. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_stream_stats.py +0 -0
  221. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_streams_v1beta2_api.py +0 -0
  222. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_subscription.py +0 -0
  223. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_subscription_v1beta2_api.py +0 -0
  224. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_time_columns.py +0 -0
  225. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_topology_v1beta2_api.py +0 -0
  226. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_udf.py +0 -0
  227. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_udf_argument.py +0 -0
  228. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_udf_auth_context.py +0 -0
  229. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_udfs_v1beta2_api.py +0 -0
  230. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_update_dashboard_request.py +0 -0
  231. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_update_source_request.py +0 -0
  232. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_update_stream_request.py +0 -0
  233. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_update_view_request.py +0 -0
  234. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_update_workspace_request.py +0 -0
  235. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_v1beta2_create_schema_request.py +0 -0
  236. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_v1beta2_licenses_body.py +0 -0
  237. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_v1beta2_list_kafka_topic_request.py +0 -0
  238. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_v1beta2_update_schema_request.py +0 -0
  239. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_view.py +0 -0
  240. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_views_v1beta2_api.py +0 -0
  241. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_workspace.py +0 -0
  242. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_workspace_settings.py +0 -0
  243. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_workspace_v1beta2_api.py +0 -0
  244. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/swagger_test/test_workspaces_v1beta2_api.py +0 -0
  245. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_alert.py +0 -0
  246. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_dashboard.py +0 -0
  247. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_schema.py +0 -0
  248. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_sqlalchemy_types.py +0 -0
  249. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_stream.py +0 -0
  250. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_topology.py +0 -0
  251. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_udf.py +0 -0
  252. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/test/test_view.py +0 -0
  253. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/__init__.py +0 -0
  254. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/alert.py +0 -0
  255. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/dashboard.py +0 -0
  256. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/error.py +0 -0
  257. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/external_stream.py +0 -0
  258. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/query.py +0 -0
  259. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/schema.py +0 -0
  260. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/sink.py +0 -0
  261. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/source.py +0 -0
  262. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/sqlalchemy.py +0 -0
  263. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/topology.py +0 -0
  264. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/type.py +0 -0
  265. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/udf.py +0 -0
  266. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus/view.py +0 -0
  267. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus.egg-info/dependency_links.txt +0 -0
  268. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus.egg-info/requires.txt +0 -0
  269. {timeplus-2.0.0b1 → timeplus-2.0.0b3}/timeplus.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timeplus
3
- Version: 2.0.0b1
3
+ Version: 2.0.0b3
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,
@@ -351,7 +351,7 @@ class Stream(object):
351
351
  """
352
352
  if mode is None:
353
353
  raise ValueError("Invalid value for `mode`, must not be `None`") # noqa: E501
354
- allowed_values = ["append", "changelog", "changelog_kv", "versioned_kv"] # noqa: E501
354
+ allowed_values = ["append", "changelog", "changelog_kv", "versioned_kv", ""] # noqa: E501
355
355
  if mode not in allowed_values:
356
356
  raise ValueError(
357
357
  "Invalid value for `mode` ({0}), must be one of {1}" # noqa: E501
@@ -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,14 +1,16 @@
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
 
8
9
  time_wait = 5
9
10
 
11
+
10
12
  def test_ingest(test_environment, test_stream):
11
- # there is one row data in test stream already
13
+ # there is 4 row data in test stream already
12
14
  time.sleep(time_wait)
13
15
  # wait previous data ingested
14
16
  data = [["time", "data"], [[1, "efgh"]]]
@@ -29,33 +31,22 @@ def test_ingest(test_environment, test_stream):
29
31
  for event in query.result():
30
32
  if event.event == "message":
31
33
  results.extend(json.loads(event.data))
32
- print(results)
33
34
 
35
+ result_length = len(results)
34
36
  assert len(results) > 1, "No data returned from the stream"
35
- assert results[1][0] == 1, "Returned time does not match the ingested integer"
36
- 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"
37
39
 
38
40
  query.delete()
39
41
 
40
42
 
41
- def test_stream_ingest_lines(test_environment,test_stream):
42
- test_stream.delete()
43
-
44
- stream = (
45
- Stream(env=test_environment)
46
- .name("test_stream")
47
- .column("raw", "string")
48
- .replication_factor(3)
49
- .shards(3)
50
- .create()
51
- )
52
- time.sleep(time_wait)
43
+ def test_stream_ingest_lines(test_environment, test_stream_raw):
53
44
 
54
45
  payload = '{"time":1,"data":"abcd"}\n{"time":2,"data":"xyz"}'
55
46
 
56
47
  # Ingest data in 'lines' format
57
48
  try:
58
- stream.ingest(payload=payload, format="lines")
49
+ test_stream_raw.ingest(payload=payload, format="lines")
59
50
  except Exception as e:
60
51
  pytest.fail(f"Ingest lines method failed with exception {e}")
61
52
 
@@ -63,45 +54,31 @@ def test_stream_ingest_lines(test_environment,test_stream):
63
54
 
64
55
  query = (
65
56
  Query(env=test_environment)
66
- .sql(query="SELECT * FROM table(test_stream)")
57
+ .sql(query="SELECT * FROM table(test_stream_raw)")
67
58
  .create()
68
59
  )
69
60
  results = []
70
61
  for event in query.result():
71
62
  if event.event == "message":
72
63
  results.extend(json.loads(event.data))
73
- print(results)
74
- print(results[0][0])
64
+
65
+ result_length = len(results)
75
66
 
76
67
  assert len(results) > 1, "No data returned from the stream"
77
- assert results[0][0] == '{"time":1,"data":"abcd"}', "Returned data does not match the ingested data"
78
- 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"
79
70
 
80
71
  query.delete()
81
72
 
82
-
83
- def test_stream_ingest_raw(test_environment,test_stream):
84
- test_stream.delete()
85
-
73
+ def test_stream_ingest_raw(test_environment, test_stream_raw):
86
74
  payload = """
87
75
  {"a":1,"b":"world"}
88
76
  {"a":2,"b":"hello"}
89
77
  """
90
78
 
91
- stream = (
92
- Stream(env=test_environment)
93
- .name("test_stream")
94
- .column("raw", "string")
95
- .replication_factor(3)
96
- .shards(3)
97
- .create()
98
- )
99
-
100
- time.sleep(time_wait)
101
-
102
79
  # Ingest data in 'raw' format
103
80
  try:
104
- stream.ingest(payload=payload, format="raw")
81
+ test_stream_raw.ingest(payload=payload, format="raw")
105
82
  except Exception as e:
106
83
  pytest.fail(f"Ingest raw method failed with exception {e}")
107
84
 
@@ -109,24 +86,23 @@ def test_stream_ingest_raw(test_environment,test_stream):
109
86
 
110
87
  query = (
111
88
  Query(env=test_environment)
112
- .sql(query="SELECT * FROM table(test_stream)")
89
+ .sql(query="SELECT * FROM table(test_stream_raw)")
113
90
  .create()
114
91
  )
115
92
  results = []
116
93
  for event in query.result():
117
94
  if event.event == "message":
118
95
  results.extend(json.loads(event.data))
119
- print(results)
120
- print(results[0][0])
121
-
96
+
97
+ result_length = len(results)
122
98
  assert results is not None, "No data returned from the stream"
123
- 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"
124
100
 
125
101
  query.delete()
126
102
 
127
103
 
128
104
  def test_json_ingest(test_environment, test_stream):
129
- # there is one row data in test stream already
105
+ # there is 4 row data in test stream already
130
106
  time.sleep(time_wait)
131
107
  # wait previous data ingested
132
108
  payload = """
@@ -151,12 +127,14 @@ def test_json_ingest(test_environment, test_stream):
151
127
  for event in query.result():
152
128
  if event.event == "message":
153
129
  results.extend(json.loads(event.data))
130
+
154
131
  print(results)
155
132
 
133
+ result_length = len(results)
156
134
  assert len(results) > 1, "No data returned from the stream"
157
- assert results[1][0] == 2, "Returned data does not match the ingested data"
158
- assert results[1][1] == 'hello', "Returned data does not match the ingested data"
159
- assert results[2][0] == 1, "Returned data does not match the ingested data"
160
- 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"
161
139
 
162
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"
@@ -1,43 +1,42 @@
1
1
  import time
2
+ import pytest
2
3
  from sqlalchemy import text, select, MetaData, Table
4
+ from datetime import timedelta
3
5
  from timeplus import View
4
6
 
5
7
 
6
- def test_driver_sql(engine):
8
+ def test_driver_sql(engine, test_stream):
7
9
  with engine.connect() as conn:
8
10
  result = conn.exec_driver_sql(
9
- "select cid from table(car_live_data) limit 5")
10
- assert len(result.fetchall()) == 5
11
+ "select * from table(test_stream) limit 2")
12
+ assert len(result.fetchall()) == 2
11
13
 
12
14
 
13
- def test_driver_sql_live(engine):
15
+ def test_driver_sql_live(engine, test_stream):
14
16
  with engine.connect() as conn:
15
17
  result = conn.exec_driver_sql(
16
- "select cid from car_live_data limit 5")
17
- assert len(result.fetchall()) == 5
18
+ "select * from test_stream where _tp_time > earliest_ts() limit 2")
19
+ assert len(result.fetchall()) == 2
18
20
 
19
-
20
- def test_text_sql(engine):
21
+ def test_text_sql(engine, test_stream):
21
22
  with engine.connect() as connection:
22
23
  result = connection.execute(
23
- text("select * from table(car_live_data) limit 3"))
24
+ text("select * from table(test_stream) limit 3"))
24
25
  rows = [row for row in result]
25
26
  assert len(rows) == 3
26
27
 
27
-
28
- def test_text_sql_live(engine):
28
+ def test_text_sql_live(engine, test_stream):
29
29
  with engine.connect() as connection:
30
30
  result = connection.execute(
31
- text("select * from car_live_data limit 3"))
31
+ text("select * from test_stream where _tp_time > earliest_ts() limit 3"))
32
32
  rows = [row for row in result]
33
33
  assert len(rows) == 3
34
34
 
35
-
36
- def test_text_streaming_sql(engine):
35
+ def test_text_streaming_sql(engine, test_stream):
37
36
  with engine.connect() as connection:
38
- result = connection.execute(text("select * from car_live_data"))
37
+ result = connection.execute(text("select * from test_stream where _tp_time > earliest_ts()"))
39
38
  count = 0
40
- max = 10
39
+ max = 3
41
40
  for row in result:
42
41
  assert row is not None
43
42
  count += 1
@@ -45,21 +44,18 @@ def test_text_streaming_sql(engine):
45
44
  break
46
45
  assert count == max
47
46
 
48
-
49
- def test_check_stream_existence(engine):
50
- table_name = "car_live_data"
47
+ def test_check_stream_existence(engine, test_stream):
48
+ table_name = "test_stream"
51
49
  with engine.connect() as conn:
52
50
  table_exists = engine.dialect.has_table(conn, table_name)
53
51
  assert table_exists
54
52
 
55
-
56
- def test_table_names(engine):
53
+ def test_table_names(engine, test_stream):
57
54
  with engine.connect() as conn:
58
55
  tables = engine.dialect.get_table_names(conn)
59
- assert "car_live_data" in tables
60
-
56
+ assert "test_stream" in tables
61
57
 
62
- def test_view_names(test_environment, engine):
58
+ def test_view_names(test_environment, engine, test_stream):
63
59
  view_name = "example_mv"
64
60
  view = View(env=test_environment).name(view_name)
65
61
 
@@ -84,7 +80,6 @@ def test_view_names(test_environment, engine):
84
80
 
85
81
  view.delete()
86
82
 
87
-
88
83
  def test_materialized_view_names(engine,test_environment,test_stream):
89
84
  view_name = "example_mv"
90
85
  view = View(env=test_environment).name(view_name)
@@ -108,30 +103,55 @@ def test_materialized_view_names(engine,test_environment,test_stream):
108
103
 
109
104
  view.delete()
110
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)
111
109
 
112
- def test_view_reflection(engine):
113
- metadata_obj = MetaData()
114
- car_view = Table("car_live_data", metadata_obj, autoload_with=engine)
115
- assert car_view is not None
116
- column_names = [c.name for c in car_view.columns]
117
- assert "speed_kmh" in column_names
110
+ try:
111
+ view.delete()
112
+ except Exception:
113
+ pass
118
114
 
115
+ view = (
116
+ View(env=test_environment)
117
+ .name(view_name)
118
+ .query("select * from test_stream")
119
+ .create()
120
+ )
119
121
 
120
- def test_table_reflection(engine):
122
+ time.sleep(1)
121
123
  metadata_obj = MetaData()
122
- car_table = Table("car_live_data", metadata_obj, autoload_with=engine)
123
- assert car_table is not None
124
- column_names = [c.name for c in car_table.columns]
125
- assert "cid" in column_names
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
126
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
127
140
 
128
- def test_select_query(engine):
141
+ def test_select_query(engine, test_stream):
129
142
  metadata_obj = MetaData()
130
- car_table = Table("car_live_data", metadata_obj, autoload_with=engine)
131
- stmt = select(car_table).where(car_table.c.speed_kmh > 50)
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
+
132
152
  with engine.connect() as conn:
133
153
  count = 0
134
- max = 3
154
+ max = 2
135
155
  for row in conn.execute(stmt):
136
156
  assert row is not None
137
157
  count += 1
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import json
2
3
  import re
3
4
  import itertools
@@ -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
 
@@ -161,14 +186,14 @@ class Connection(object):
161
186
  def _get_table(self, name):
162
187
  try:
163
188
  return Stream(env=self.env).name(name).get()
164
- except:
189
+ except: # noqa: E722
165
190
  return ExternalStream(env=self.env).name(name).get()
166
191
 
167
192
  def _get_view(self, name):
168
193
  return View(env=self.env).name(name).get()
169
194
 
170
195
  def _list_table(self):
171
- streams = Stream(env=self.env).list()
196
+ streams = Stream(env=self.env).list()
172
197
  estreams = ExternalStream(env=self.env).list()
173
198
 
174
199
  return streams + estreams