Generated by Cython 3.0.12
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: ingress.c
+0001: ################################################################################
__pyx_t_19 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_19) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
0002: ## ___ _ ____ ____
0003: ## / _ \ _ _ ___ ___| |_| _ \| __ )
0004: ## | | | | | | |/ _ \/ __| __| | | | _ \
0005: ## | |_| | |_| | __/\__ \ |_| |_| | |_) |
0006: ## \__\_\\__,_|\___||___/\__|____/|____/
0007: ##
0008: ## Copyright (c) 2014-2019 Appsicle
0009: ## Copyright (c) 2019-2024 QuestDB
0010: ##
0011: ## Licensed under the Apache License, Version 2.0 (the "License");
0012: ## you may not use this file except in compliance with the License.
0013: ## You may obtain a copy of the License at
0014: ##
0015: ## http://www.apache.org/licenses/LICENSE-2.0
0016: ##
0017: ## Unless required by applicable law or agreed to in writing, software
0018: ## distributed under the License is distributed on an "AS IS" BASIS,
0019: ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0020: ## See the License for the specific language governing permissions and
0021: ## limitations under the License.
0022: ##
0023: ################################################################################
0024:
0025: # distutils: language=c
0026: # cython: language_level=3
0027: # cython: binding=True
0028:
0029: """
0030: API for fast data ingestion into QuestDB.
0031: """
0032:
+0033: __all__ = [
__pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_Buffer); __Pyx_GIVEREF(__pyx_n_u_Buffer); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Buffer)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_IngressError); __Pyx_GIVEREF(__pyx_n_u_IngressError); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_IngressError)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_IngressErrorCode); __Pyx_GIVEREF(__pyx_n_u_IngressErrorCode); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_u_IngressErrorCode)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_Protocol); __Pyx_GIVEREF(__pyx_n_u_Protocol); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_u_Protocol)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_Sender); __Pyx_GIVEREF(__pyx_n_u_Sender); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_u_Sender)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_ServerTimestamp_2); __Pyx_GIVEREF(__pyx_n_u_ServerTimestamp_2); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_u_ServerTimestamp_2)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_TimestampMicros_2); __Pyx_GIVEREF(__pyx_n_u_TimestampMicros_2); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_u_TimestampMicros_2)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_TimestampNanos_2); __Pyx_GIVEREF(__pyx_n_u_TimestampNanos_2); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_u_TimestampNanos_2)) __PYX_ERR(0, 33, __pyx_L1_error); __Pyx_INCREF(__pyx_n_u_TlsCa); __Pyx_GIVEREF(__pyx_n_u_TlsCa); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_u_TlsCa)) __PYX_ERR(0, 33, __pyx_L1_error); if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0034: 'Buffer',
0035: 'IngressError',
0036: 'IngressErrorCode',
0037: 'Protocol',
0038: 'Sender',
0039: 'ServerTimestamp',
0040: 'TimestampMicros',
0041: 'TimestampNanos',
0042: 'TlsCa',
0043: ]
0044:
0045: # For prototypes: https://github.com/cython/cython/tree/master/Cython/Includes
0046: from libc.stdint cimport uint8_t, uint64_t, int64_t, uint32_t, uintptr_t, \
0047: INT64_MAX, INT64_MIN
0048: from libc.stdlib cimport malloc, calloc, realloc, free, abort, qsort
0049: from libc.string cimport strncmp, memset
0050: from libc.math cimport isnan
0051: from libc.errno cimport errno
0052: # from libc.stdio cimport stderr, fprintf
0053: from cpython.datetime cimport datetime, timedelta
0054: from cpython.bool cimport bool
0055: from cpython.weakref cimport PyWeakref_NewRef, PyWeakref_GetObject
0056: from cpython.object cimport PyObject
0057: from cpython.buffer cimport Py_buffer, PyObject_CheckBuffer, \
0058: PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE
0059: from cpython.memoryview cimport PyMemoryView_FromMemory
0060:
0061: from .line_sender cimport *
0062: from .pystr_to_utf8 cimport *
0063: from .conf_str cimport *
0064: from .arrow_c_data_interface cimport *
0065: from .extra_cpython cimport *
0066: from .ingress_helper cimport *
0067:
0068: # An int we use only for error reporting.
0069: # 0 is success.
0070: # -1 is failure.
0071: ctypedef int void_int
0072:
0073: import cython
0074: include "dataframe.pxi"
0075:
0076:
+0077: from enum import Enum
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_Enum); __Pyx_GIVEREF(__pyx_n_s_Enum); if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Enum)) __PYX_ERR(0, 77, __pyx_L1_error); __pyx_t_15 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_3, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_15, __pyx_n_s_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_3) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0078: from typing import List, Tuple, Dict, Union, Any, Optional, Callable, \
__pyx_t_15 = PyList_New(8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 0, __pyx_n_s_List)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Tuple); __Pyx_GIVEREF(__pyx_n_s_Tuple); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_Tuple)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 2, __pyx_n_s_Dict)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Union); __Pyx_GIVEREF(__pyx_n_s_Union); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 3, __pyx_n_s_Union)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Any); __Pyx_GIVEREF(__pyx_n_s_Any); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 4, __pyx_n_s_Any)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Optional); __Pyx_GIVEREF(__pyx_n_s_Optional); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 5, __pyx_n_s_Optional)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Callable); __Pyx_GIVEREF(__pyx_n_s_Callable); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 6, __pyx_n_s_Callable)) __PYX_ERR(0, 78, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Iterable); __Pyx_GIVEREF(__pyx_n_s_Iterable); if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 7, __pyx_n_s_Iterable)) __PYX_ERR(0, 78, __pyx_L1_error); __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_15, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Any); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Optional); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Callable); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_15) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_15) < 0) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0079: Iterable
+0080: import pathlib
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_pathlib, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathlib, __pyx_t_3) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0081:
+0082: import sys
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_3) < 0) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0083: import os
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_3) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0084:
0085:
0086: # This value is automatically updated by the `bump2version` tool.
0087: # If you need to update it, also update the search definition in
0088: # .bumpversion.cfg.
+0089: VERSION = '2.0.4'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_kp_u_2_0_4) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
0090:
0091:
+0092: cdef bint _has_gil(PyThreadState** gs):
static int __pyx_f_7questdb_7ingress__has_gil(PyThreadState **__pyx_v_gs) { int __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
+0093: return gs[0] == NULL
__pyx_r = ((__pyx_v_gs[0]) == NULL); goto __pyx_L0;
0094:
0095:
+0096: cdef bint _ensure_doesnt_have_gil(PyThreadState** gs):
static int __pyx_f_7questdb_7ingress__ensure_doesnt_have_gil(PyThreadState **__pyx_v_gs) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("questdb.ingress._ensure_doesnt_have_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0097: """Returns True if previously had the GIL, False otherwise."""
+0098: if _has_gil(gs):
__pyx_t_1 = __pyx_f_7questdb_7ingress__has_gil(__pyx_v_gs); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+0099: gs[0] = PyEval_SaveThread()
(__pyx_v_gs[0]) = PyEval_SaveThread();
+0100: return True
__pyx_r = 1; goto __pyx_L0;
+0101: return False
__pyx_r = 0; goto __pyx_L0;
0102:
0103:
+0104: cdef void _ensure_has_gil(PyThreadState** gs):
static void __pyx_f_7questdb_7ingress__ensure_has_gil(PyThreadState **__pyx_v_gs) {
/* … */
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("questdb.ingress._ensure_has_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
}
+0105: if not _has_gil(gs):
__pyx_t_1 = __pyx_f_7questdb_7ingress__has_gil(__pyx_v_gs); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+0106: PyEval_RestoreThread(gs[0])
PyEval_RestoreThread((__pyx_v_gs[0]));
+0107: gs[0] = NULL
(__pyx_v_gs[0]) = NULL;
0108:
0109:
+0110: class IngressErrorCode(Enum):
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_GIVEREF(__pyx_t_3); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PEP560_update_bases(__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = __Pyx_Py3MetaclassPrepare(__pyx_t_19, __pyx_t_3, __pyx_n_s_IngressErrorCode, __pyx_n_s_IngressErrorCode, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_Category_of_Error); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_3 != __pyx_t_15) { if (unlikely((PyDict_SetItemString(__pyx_t_18, "__orig_bases__", __pyx_t_15) < 0))) __PYX_ERR(0, 110, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; /* … */ __pyx_t_20 = __Pyx_Py3ClassCreate(__pyx_t_19, __pyx_n_s_IngressErrorCode, __pyx_t_3, __pyx_t_18, NULL, 0, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IngressErrorCode, __pyx_t_20) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0111: """Category of Error."""
+0112: CouldNotResolveAddr = line_sender_error_could_not_resolve_addr
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_could_not_resolve_addr); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_CouldNotResolveAddr, __pyx_t_15) < 0) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0113: InvalidApiCall = line_sender_error_invalid_api_call
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_api_call); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_InvalidApiCall, __pyx_t_15) < 0) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0114: SocketError = line_sender_error_socket_error
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_socket_error); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_SocketError, __pyx_t_15) < 0) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0115: InvalidUtf8 = line_sender_error_invalid_utf8
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_utf8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_InvalidUtf8, __pyx_t_15) < 0) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0116: InvalidName = line_sender_error_invalid_name
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_name); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_InvalidName, __pyx_t_15) < 0) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0117: InvalidTimestamp = line_sender_error_invalid_timestamp
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_timestamp); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_InvalidTimestamp, __pyx_t_15) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0118: AuthError = line_sender_error_auth_error
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_auth_error); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_AuthError, __pyx_t_15) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0119: TlsError = line_sender_error_tls_error
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_tls_error); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_TlsError, __pyx_t_15) < 0) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0120: HttpNotSupported = line_sender_error_http_not_supported
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_http_not_supported); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_HttpNotSupported, __pyx_t_15) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0121: ServerFlushError = line_sender_error_server_flush_error
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_server_flush_error); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_ServerFlushError, __pyx_t_15) < 0) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0122: ConfigError = line_sender_error_config_error
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_config_error); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_ConfigError, __pyx_t_15) < 0) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+0123: BadDataFrame = <int>line_sender_error_server_flush_error + 1
__pyx_t_15 = __Pyx_PyInt_From_long((((int)line_sender_error_server_flush_error) + 1)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_BadDataFrame, __pyx_t_15) < 0) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
0124:
+0125: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_16IngressErrorCode___str__, "Return the name of the enum."); static PyMethodDef __pyx_mdef_7questdb_7ingress_16IngressErrorCode_1__str__ = {"__str__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_16IngressErrorCode___str__}; static PyObject *__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__str__") < 0)) __PYX_ERR(0, 125, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_self = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__str__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 125, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.IngressErrorCode.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_16IngressErrorCode___str__(__pyx_self, __pyx_v_self); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_16IngressErrorCode___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.IngressErrorCode.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__46); __Pyx_GIVEREF(__pyx_tuple__46); /* … */ __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_return, __pyx_n_s_str) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_16IngressErrorCode_1__str__, 0, __pyx_n_s_IngressErrorCode___str, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_str_2, __pyx_t_20) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_str_2, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 125, __pyx_L1_error)
0126: """Return the name of the enum."""
+0127: return self.name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(0, 127, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
0128:
0129:
+0130: class IngressError(Exception):
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); __Pyx_GIVEREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])))) __PYX_ERR(0, 130, __pyx_L1_error); __pyx_t_19 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = __Pyx_CalculateMetaclass(NULL, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_20 = __Pyx_Py3MetaclassPrepare(__pyx_t_18, __pyx_t_19, __pyx_n_s_IngressError, __pyx_n_s_IngressError, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_An_error_whilst_using_the_Sender); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); if (__pyx_t_19 != __pyx_t_3) { if (unlikely((PyDict_SetItemString(__pyx_t_20, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(0, 130, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_15 = __Pyx_Py3ClassCreate(__pyx_t_18, __pyx_n_s_IngressError, __pyx_t_19, __pyx_t_20, NULL, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__Pyx_CyFunction_InitClassCell(__pyx_t_3, __pyx_t_15) < 0) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_IngressError, __pyx_t_15) < 0) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
0131: """An error whilst using the ``Sender`` or constructing its ``Buffer``."""
+0132: def __init__(self, code, msg):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_1__init__(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_12IngressError_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_12IngressError_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_1__init__(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_code = 0; PyObject *__pyx_v_msg = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_code,&__pyx_n_s_msg,0}; PyObject* values[3] = {0,0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_code)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 132, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_msg)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 132, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 132, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } __pyx_v_self = values[0]; __pyx_v_code = values[1]; __pyx_v_msg = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 132, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.IngressError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_12IngressError___init__(__pyx_self, __pyx_v_self, __pyx_v_code, __pyx_v_msg); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_12IngressError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_code, PyObject *__pyx_v_msg) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.IngressError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_code, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); /* … */ __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_12IngressError_1__init__, 0, __pyx_n_s_IngressError___init, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_t_15); PyList_Append(__pyx_t_3, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); if (__Pyx_SetNameInClass(__pyx_t_20, __pyx_n_s_init, __pyx_t_15) < 0) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_init, 132, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 132, __pyx_L1_error)
+0133: super().__init__(msg)
__pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 133, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self)) __PYX_ERR(0, 133, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_msg}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0134: self._code = code
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code_2, __pyx_v_code) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
0135:
+0136: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_3code(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_12IngressError_2code, "Return the error code."); static PyMethodDef __pyx_mdef_7questdb_7ingress_12IngressError_3code = {"code", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_12IngressError_3code, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_12IngressError_2code}; static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_3code(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("code (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "code") < 0)) __PYX_ERR(0, 136, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_self = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("code", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 136, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.IngressError.code", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_12IngressError_2code(__pyx_self, __pyx_v_self); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_12IngressError_2code(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.IngressError.code", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_return, __pyx_n_s_IngressErrorCode) < 0) __PYX_ERR(0, 136, __pyx_L1_error) __pyx_t_16 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_12IngressError_3code, 0, __pyx_n_s_IngressError_code, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_16, __pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; if (__Pyx_SetNameInClass(__pyx_t_20, __pyx_n_s_code, __pyx_t_15) < 0) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; /* … */ __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_code, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 136, __pyx_L1_error)
0137: def code(self) -> IngressErrorCode:
0138: """Return the error code."""
+0139: return self._code
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0140:
0141:
+0142: cdef inline object c_err_code_to_py(line_sender_error_code code):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_code_to_py(enum line_sender_error_code __pyx_v_code) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.c_err_code_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0143: if code == line_sender_error_could_not_resolve_addr:
switch (__pyx_v_code) { case line_sender_error_could_not_resolve_addr: /* … */ break; case line_sender_error_invalid_api_call:
+0144: return IngressErrorCode.CouldNotResolveAddr
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CouldNotResolveAddr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0145: elif code == line_sender_error_invalid_api_call:
break; case line_sender_error_socket_error:
+0146: return IngressErrorCode.InvalidApiCall
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0147: elif code == line_sender_error_socket_error:
break; case line_sender_error_invalid_utf8:
+0148: return IngressErrorCode.SocketError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0149: elif code == line_sender_error_invalid_utf8:
break; case line_sender_error_invalid_name:
+0150: return IngressErrorCode.InvalidUtf8
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidUtf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0151: elif code == line_sender_error_invalid_name:
break; case line_sender_error_invalid_timestamp:
+0152: return IngressErrorCode.InvalidName
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InvalidName); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0153: elif code == line_sender_error_invalid_timestamp:
break; case line_sender_error_auth_error:
+0154: return IngressErrorCode.InvalidTimestamp
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0155: elif code == line_sender_error_auth_error:
break; case line_sender_error_tls_error:
+0156: return IngressErrorCode.AuthError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AuthError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0157: elif code == line_sender_error_tls_error:
break; case line_sender_error_http_not_supported:
+0158: return IngressErrorCode.TlsError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TlsError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0159: elif code == line_sender_error_http_not_supported:
break; case line_sender_error_server_flush_error:
+0160: return IngressErrorCode.HttpNotSupported
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_HttpNotSupported); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0161: elif code == line_sender_error_server_flush_error:
break; case line_sender_error_config_error:
+0162: return IngressErrorCode.ServerFlushError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ServerFlushError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0163: elif code == line_sender_error_config_error:
break; default:
+0164: return IngressErrorCode.ConfigError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0165: else:
+0166: raise ValueError('Internal error converting error code.')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 166, __pyx_L1_error) break; } /* … */ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_Internal_error_converting_error); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29);
0167:
0168:
+0169: cdef inline object c_err_to_code_and_msg(line_sender_error* err):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_code_and_msg(struct line_sender_error *__pyx_v_err) { enum line_sender_error_code __pyx_v_code; size_t __pyx_v_c_len; char const *__pyx_v_c_msg; PyObject *__pyx_v_py_msg = 0; PyObject *__pyx_v_py_code = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.c_err_to_code_and_msg", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_msg); __Pyx_XDECREF(__pyx_v_py_code); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0170: """Construct a ``SenderError`` from a C error, which will be freed."""
+0171: cdef line_sender_error_code code = line_sender_error_get_code(err)
__pyx_v_code = line_sender_error_get_code(__pyx_v_err);
+0172: cdef size_t c_len = 0
__pyx_v_c_len = 0;
+0173: cdef const char* c_msg = line_sender_error_msg(err, &c_len)
__pyx_v_c_msg = line_sender_error_msg(__pyx_v_err, (&__pyx_v_c_len));
0174: cdef object py_err
0175: cdef object py_msg
0176: cdef object py_code
+0177: try:
/*try:*/ {
+0178: py_code = c_err_code_to_py(code)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_code_to_py(__pyx_v_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_code = __pyx_t_1; __pyx_t_1 = 0;
+0179: py_msg = PyUnicode_FromStringAndSize(c_msg, <Py_ssize_t>c_len)
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_c_msg, ((Py_ssize_t)__pyx_v_c_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_msg = __pyx_t_1; __pyx_t_1 = 0;
+0180: return (py_code, py_msg)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_py_code); __Pyx_GIVEREF(__pyx_v_py_code); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_py_code)) __PYX_ERR(0, 180, __pyx_L4_error); __Pyx_INCREF(__pyx_v_py_msg); __Pyx_GIVEREF(__pyx_v_py_msg); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_py_msg)) __PYX_ERR(0, 180, __pyx_L4_error); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L3_return; }
0181: finally:
+0182: line_sender_error_free(err)
/*finally:*/ { __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename; { line_sender_error_free(__pyx_v_err); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); } __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_10 = __pyx_r; __pyx_r = 0; line_sender_error_free(__pyx_v_err); __pyx_r = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L0; } }
0183:
0184:
+0185: cdef inline object c_err_to_py(line_sender_error* err):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_py(struct line_sender_error *__pyx_v_err) { PyObject *__pyx_v_tup = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.c_err_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0186: """Construct an ``IngressError`` from a C error, which will be freed."""
+0187: cdef object tup = c_err_to_code_and_msg(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_code_and_msg(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_tup = __pyx_t_1; __pyx_t_1 = 0;
+0188: return IngressError(tup[0], tup[1])
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_tup, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_tup, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0189:
0190:
+0191: cdef inline object c_err_to_py_fmt(line_sender_error* err, str fmt):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_py_fmt(struct line_sender_error *__pyx_v_err, PyObject *__pyx_v_fmt) { PyObject *__pyx_v_tup = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.c_err_to_py_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0192: """Construct an ``IngressError`` from a C error, which will be freed."""
+0193: cdef object tup = c_err_to_code_and_msg(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_code_and_msg(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_tup = __pyx_t_1; __pyx_t_1 = 0;
+0194: return IngressError(tup[0], fmt.format(tup[1]))
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_tup, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_tup, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyUnicode_Type_format, __pyx_v_fmt, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_5}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0195:
0196:
+0197: cdef object _utf8_decode_error(
static PyObject *__pyx_f_7questdb_7ingress__utf8_decode_error(PyObject *__pyx_v_string, uint32_t __pyx_v_bad_codepoint) { PyObject *__pyx_v_s = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("questdb.ingress._utf8_decode_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_s); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0198: PyObject* string, uint32_t bad_codepoint):
+0199: cdef str s = <str><object>string
__pyx_t_1 = ((PyObject *)__pyx_v_string);
__Pyx_INCREF(__pyx_t_1);
__pyx_v_s = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
+0200: return IngressError(
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0201: IngressErrorCode.InvalidUtf8,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidUtf8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0202: f'Invalid codepoint 0x{bad_codepoint:x} in string {s!r}: ' +
__pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_Invalid_codepoint_0x); __pyx_t_5 += 20; __Pyx_GIVEREF(__pyx_kp_u_Invalid_codepoint_0x); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Invalid_codepoint_0x); __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_bad_codepoint); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_n_u_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_kp_u_in_string); __pyx_t_5 += 11; __Pyx_GIVEREF(__pyx_kp_u_in_string); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_in_string); __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_s), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_kp_u__21); __pyx_t_5 += 2; __Pyx_GIVEREF(__pyx_kp_u__21); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__21); __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_8, __pyx_kp_u_Cannot_be_encoded_as_UTF_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0203: 'Cannot be encoded as UTF-8.')
0204:
0205:
+0206: cdef str _fqn(type obj):
static PyObject *__pyx_f_7questdb_7ingress__fqn(PyTypeObject *__pyx_v_obj) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ingress._fqn", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0207: if obj.__module__ == 'builtins':
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_obj), __pyx_n_s_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_builtins, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+0208: return obj.__qualname__
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_obj), __pyx_n_s_qualname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(0, 208, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
0209: else:
+0210: return f'{obj.__module__}.{obj.__qualname__}'
/*else*/ { __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = 127; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_obj), __pyx_n_s_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u__5); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_obj), __pyx_n_s_qualname); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; }
0211:
0212:
+0213: cdef inline void_int _encode_utf8(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress__encode_utf8(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_utf8 *__pyx_v_utf8_out) { uint32_t __pyx_v_bad_codepoint; size_t __pyx_v_count; int __pyx_v_kind; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress._encode_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0214: qdb_pystr_buf* b,
0215: PyObject* string,
0216: line_sender_utf8* utf8_out) except -1:
+0217: cdef uint32_t bad_codepoint = 0
__pyx_v_bad_codepoint = 0;
+0218: cdef size_t count = <size_t>(PyUnicode_GET_LENGTH(string))
__pyx_v_count = ((size_t)PyUnicode_GET_LENGTH(__pyx_v_string));
+0219: cdef int kind = PyUnicode_KIND(string)
__pyx_v_kind = PyUnicode_KIND(__pyx_v_string);
+0220: if kind == PyUnicode_1BYTE_KIND:
switch (__pyx_v_kind) { case PyUnicode_1BYTE_KIND: /* … */ break; case PyUnicode_2BYTE_KIND:
0221: # No error handling for UCS1: All code points translate into valid UTF8.
+0222: qdb_ucs1_to_utf8(
qdb_ucs1_to_utf8(__pyx_v_b, __pyx_v_count, PyUnicode_1BYTE_DATA(__pyx_v_string), (&__pyx_v_utf8_out->len), (&__pyx_v_utf8_out->buf));
0223: b,
0224: count,
0225: PyUnicode_1BYTE_DATA(string),
0226: &utf8_out.len,
0227: &utf8_out.buf)
+0228: elif kind == PyUnicode_2BYTE_KIND:
break; case PyUnicode_4BYTE_KIND:
+0229: if not qdb_ucs2_to_utf8(
__pyx_t_1 = (!qdb_ucs2_to_utf8(__pyx_v_b, __pyx_v_count, PyUnicode_2BYTE_DATA(__pyx_v_string), (&__pyx_v_utf8_out->len), (&__pyx_v_utf8_out->buf), (&__pyx_v_bad_codepoint))); if (unlikely(__pyx_t_1)) { /* … */ }
0230: b,
0231: count,
0232: PyUnicode_2BYTE_DATA(string),
0233: &utf8_out.len,
0234: &utf8_out.buf,
0235: &bad_codepoint):
+0236: raise _utf8_decode_error(string, bad_codepoint)
__pyx_t_2 = __pyx_f_7questdb_7ingress__utf8_decode_error(__pyx_v_string, __pyx_v_bad_codepoint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 236, __pyx_L1_error)
+0237: elif kind == PyUnicode_4BYTE_KIND:
break; default:
+0238: if not qdb_ucs4_to_utf8(
__pyx_t_1 = (!qdb_ucs4_to_utf8(__pyx_v_b, __pyx_v_count, ((uint32_t const *)PyUnicode_4BYTE_DATA(__pyx_v_string)), (&__pyx_v_utf8_out->len), (&__pyx_v_utf8_out->buf), (&__pyx_v_bad_codepoint))); if (unlikely(__pyx_t_1)) { /* … */ }
0239: b,
0240: count,
0241:
0242: # This cast is required and is possibly a Cython compiler bug.
0243: # It doesn't recognize that `const Py_UCS4*`
0244: # is the same as `const uint32_t*`.
0245: <const uint32_t*>PyUnicode_4BYTE_DATA(string),
0246:
0247: &utf8_out.len,
0248: &utf8_out.buf,
0249: &bad_codepoint):
+0250: raise _utf8_decode_error(string, bad_codepoint)
__pyx_t_2 = __pyx_f_7questdb_7ingress__utf8_decode_error(__pyx_v_string, __pyx_v_bad_codepoint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 250, __pyx_L1_error)
0251: else:
+0252: raise ValueError(f'Unknown UCS kind: {kind}.')
__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = 127; __Pyx_INCREF(__pyx_kp_u_Unknown_UCS_kind); __pyx_t_3 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unknown_UCS_kind); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Unknown_UCS_kind); __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_kind, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__5); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__5); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__5); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 252, __pyx_L1_error) break; }
0253:
0254:
+0255: cdef void_int str_to_utf8(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_utf8(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_utf8 *__pyx_v_utf8_out) { __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0256: qdb_pystr_buf* b,
0257: PyObject* string,
0258: line_sender_utf8* utf8_out) except -1:
0259: """
0260: Convert a Python string to a UTF-8 borrowed buffer.
0261: This is done without allocating new Python `bytes` objects.
0262: In case the string is an ASCII string, it's also generally zero-copy.
0263: The `utf8_out` param will point to (borrow from) either the ASCII buffer
0264: inside the original Python object or a part of memory allocated inside the
0265: `b` buffer.
0266:
0267: If you need to use `utf8_out` without the GIL, call `qdb_pystr_buf_copy`.
0268: """
+0269: if not PyUnicode_CheckExact(string):
__pyx_t_1 = (!PyUnicode_CheckExact(__pyx_v_string));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0270: raise TypeError(
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 270, __pyx_L1_error)
+0271: 'Expected a str object, not an object of type ' +
__pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_Expected_a_str_object_not_an_obj, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0272: _fqn(type(<str><object>string)))
__pyx_t_2 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_string))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0273: PyUnicode_READY(string)
__pyx_t_4 = PyUnicode_READY(__pyx_v_string); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 273, __pyx_L1_error)
0274:
0275: # We optimize the common case of ASCII strings.
0276: # This avoid memory allocations and copies altogether.
0277: # We get away with this because ASCII is a subset of UTF-8.
+0278: if PyUnicode_IS_COMPACT_ASCII(string):
__pyx_t_1 = PyUnicode_IS_COMPACT_ASCII(__pyx_v_string);
if (__pyx_t_1) {
/* … */
}
+0279: utf8_out.len = <size_t>(PyUnicode_GET_LENGTH(string))
__pyx_v_utf8_out->len = ((size_t)PyUnicode_GET_LENGTH(__pyx_v_string));
+0280: utf8_out.buf = <const char*>(PyUnicode_1BYTE_DATA(string))
__pyx_v_utf8_out->buf = ((char const *)PyUnicode_1BYTE_DATA(__pyx_v_string));
+0281: return 0
__pyx_r = 0; goto __pyx_L0;
0282:
+0283: _encode_utf8(b, string, utf8_out)
__pyx_t_5 = __pyx_f_7questdb_7ingress__encode_utf8(__pyx_v_b, __pyx_v_string, __pyx_v_utf8_out); if (unlikely(__pyx_t_5 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 283, __pyx_L1_error)
0284:
0285:
0286:
+0287: cdef void_int str_to_utf8_copy(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_utf8_copy(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_utf8 *__pyx_v_utf8_out) { __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_utf8_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0288: qdb_pystr_buf* b,
0289: PyObject* string,
0290: line_sender_utf8* utf8_out) except -1:
0291: """
0292: Variant of `str_to_utf8` that always copies the string to a new buffer.
0293:
0294: The resulting `utf8_out` can be used when not holding the GIL:
0295: The pointed-to memory is owned by `b`.
0296: """
+0297: if not PyUnicode_CheckExact(string):
__pyx_t_1 = (!PyUnicode_CheckExact(__pyx_v_string));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0298: raise TypeError(
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 298, __pyx_L1_error)
+0299: 'Expected a str object, not an object of type ' +
__pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_Expected_a_str_object_not_an_obj, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0300: _fqn(type(<str><object>string)))
__pyx_t_2 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_string))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
0301:
+0302: PyUnicode_READY(string)
__pyx_t_4 = PyUnicode_READY(__pyx_v_string); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 302, __pyx_L1_error)
+0303: _encode_utf8(b, string, utf8_out)
__pyx_t_5 = __pyx_f_7questdb_7ingress__encode_utf8(__pyx_v_b, __pyx_v_string, __pyx_v_utf8_out); if (unlikely(__pyx_t_5 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 303, __pyx_L1_error)
0304:
0305:
+0306: cdef void_int str_to_table_name(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_table_name(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_table_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_table_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0307: qdb_pystr_buf* b,
0308: PyObject* string,
0309: line_sender_table_name* name_out) except -1:
0310: """
0311: Python string to borrowed C table name.
0312: Also see `str_to_utf8`.
0313: """
+0314: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0315: cdef line_sender_utf8 utf8
+0316: str_to_utf8(b, string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, __pyx_v_string, (&__pyx_v_utf8)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 316, __pyx_L1_error)
+0317: if not line_sender_table_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = (!line_sender_table_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0318: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 318, __pyx_L1_error)
0319:
0320:
+0321: cdef void_int str_to_table_name_copy(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_table_name_copy(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_table_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_table_name_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0322: qdb_pystr_buf* b,
0323: PyObject* string,
0324: line_sender_table_name* name_out) except -1:
0325: """
0326: Python string to copied C table name.
0327: Also see `str_to_utf8_copy`.
0328: """
+0329: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0330: cdef line_sender_utf8 utf8
+0331: str_to_utf8_copy(b, string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8_copy(__pyx_v_b, __pyx_v_string, (&__pyx_v_utf8)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 331, __pyx_L1_error)
+0332: if not line_sender_table_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = (!line_sender_table_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0333: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 333, __pyx_L1_error)
0334:
0335:
+0336: cdef void_int str_to_column_name(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_column_name(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_column_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_column_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0337: qdb_pystr_buf* b,
0338: str string,
0339: line_sender_column_name* name_out) except -1:
0340: """
0341: Python string to borrowed C column name.
0342: Also see `str_to_utf8`.
0343: """
+0344: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0345: cdef line_sender_utf8 utf8
+0346: str_to_utf8(b, <PyObject*>string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_string), (&__pyx_v_utf8)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 346, __pyx_L1_error)
+0347: if not line_sender_column_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = (!line_sender_column_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0348: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 348, __pyx_L1_error)
0349:
0350:
+0351: cdef void_int str_to_column_name_copy(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_str_to_column_name_copy(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_string, struct line_sender_column_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_column_name_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0352: qdb_pystr_buf* b,
0353: str string,
0354: line_sender_column_name* name_out) except -1:
0355: """
0356: Python string to copied C column name.
0357: Also see `str_to_utf8_copy`.
0358: """
+0359: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0360: cdef line_sender_utf8 utf8
+0361: str_to_utf8_copy(b, <PyObject*>string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8_copy(__pyx_v_b, ((PyObject *)__pyx_v_string), (&__pyx_v_utf8)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 361, __pyx_L1_error)
+0362: if not line_sender_column_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = (!line_sender_column_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0363: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 363, __pyx_L1_error)
0364:
0365:
+0366: cdef int64_t datetime_to_micros(datetime dt):
static int64_t __pyx_f_7questdb_7ingress_datetime_to_micros(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.datetime_to_micros", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0367: """
0368: Convert a `datetime.datetime` to microseconds since the epoch.
0369: """
0370: return (
+0371: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0372: <int64_t>(1000000) +
__pyx_r = ((((int64_t)__pyx_t_5) * ((int64_t)0xF4240)) + ((int64_t)__pyx_f_7cpython_8datetime_8datetime_11microsecond_microsecond(__pyx_v_dt))); goto __pyx_L0;
0373: <int64_t>(dt.microsecond))
0374:
0375:
+0376: cdef int64_t datetime_to_nanos(datetime dt):
static int64_t __pyx_f_7questdb_7ingress_datetime_to_nanos(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.datetime_to_nanos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0377: """
0378: Convert a `datetime.datetime` to nanoseconds since the epoch.
0379: """
0380: return (
+0381: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0382: <int64_t>(1000000000) +
__pyx_r = ((((int64_t)__pyx_t_5) * ((int64_t)0x3B9ACA00)) + ((int64_t)(__pyx_f_7cpython_8datetime_8datetime_11microsecond_microsecond(__pyx_v_dt) * 0x3E8))); goto __pyx_L0;
0383: <int64_t>(dt.microsecond * 1000))
0384:
+0385: cdef class _ServerTimestamp:
struct __pyx_obj_7questdb_7ingress__ServerTimestamp { PyObject_HEAD };
0386: """
0387: A placeholder value to indicate using a server-generated-timestamp.
0388: """
0389: pass
0390:
+0391: ServerTimestamp = _ServerTimestamp()
__pyx_t_19 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7questdb_7ingress__ServerTimestamp)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ServerTimestamp_2, __pyx_t_19) < 0) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
0392:
+0393: cdef class TimestampMicros:
struct __pyx_obj_7questdb_7ingress_TimestampMicros { PyObject_HEAD int64_t _value; };
0394: """
0395: A timestamp in microseconds since the UNIX epoch (UTC).
0396:
0397: You may construct a ``TimestampMicros`` from an integer or a
0398: ``datetime.datetime``, or simply call the :func:`TimestampMicros.now`
0399: method.
0400:
0401: .. code-block:: python
0402:
0403: # Recommended way to get the current timestamp.
0404: TimestampMicros.now()
0405:
0406: # The above is equivalent to:
0407: TimestampMicros(time.time_ns() // 1000)
0408:
0409: # You can provide a numeric timestamp too. It can't be negative.
0410: TimestampMicros(1657888365426838)
0411:
0412: ``TimestampMicros`` can also be constructed from a ``datetime.datetime``
0413: object.
0414:
0415: .. code-block:: python
0416:
0417: TimestampMicros.from_datetime(
0418: datetime.datetime.now(tz=datetime.timezone.utc))
0419:
0420: We recommend that when using ``datetime`` objects, you explicitly pass in
0421: the timezone to use. This is because ``datetime`` objects without an
0422: associated timezone are assumed to be in the local timezone and it is easy
0423: to make mistakes (e.g. passing ``datetime.datetime.utcnow()`` is a likely
0424: bug).
0425: """
0426: cdef int64_t _value
0427:
+0428: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 428, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } __pyx_v_value = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 428, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyInt_Type), 0, "value", 1))) __PYX_ERR(0, 428, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros___cinit__(((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_15TimestampMicros___cinit__(struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0429: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0430: raise ValueError('value must be a positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 430, __pyx_L1_error) /* … */ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_value_must_be_a_positive_integer); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30);
+0431: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0432:
+0433: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_15TimestampMicros_2from_datetime, "\n Construct a ``TimestampMicros`` from a ``datetime.datetime`` object.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_15TimestampMicros_3from_datetime = {"from_datetime", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_15TimestampMicros_2from_datetime}; static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyDateTime_DateTime *__pyx_v_dt = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dt,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dt)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "from_datetime") < 0)) __PYX_ERR(0, 433, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_dt = ((PyDateTime_DateTime *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("from_datetime", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 433, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TimestampMicros.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 0, "dt", 0))) __PYX_ERR(0, 434, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_2from_datetime(((PyTypeObject*)__pyx_v_cls), __pyx_v_dt); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_dt); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_dt, __pyx_n_s_datetime) < 0) __PYX_ERR(0, 433, __pyx_L1_error) __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_15TimestampMicros_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampMicros_from_datetime, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_18, __pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_from_datetime, __pyx_t_18) < 0) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros); __Pyx_GetNameInClass(__pyx_t_18, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_19 = __Pyx_Method_ClassMethod(__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_from_datetime, __pyx_t_19) < 0) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros); __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_datetime, 433, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 433, __pyx_L1_error)
0434: def from_datetime(cls, dt: datetime):
0435: """
0436: Construct a ``TimestampMicros`` from a ``datetime.datetime`` object.
0437: """
+0438: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = (!__pyx_t_1);
if (unlikely(__pyx_t_2)) {
/* … */
}
+0439: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 439, __pyx_L1_error) /* … */ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_dt_must_be_a_datetime_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31);
+0440: return cls(datetime_to_micros(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __pyx_f_7questdb_7ingress_datetime_to_micros(__pyx_v_dt); if (unlikely(__pyx_t_4 == ((int64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
0441:
+0442: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5now(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_15TimestampMicros_4now, "\n Construct a ``TimestampMicros`` from the current time as UTC.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_15TimestampMicros_5now = {"now", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_15TimestampMicros_5now, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_15TimestampMicros_4now}; static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5now(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("now (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("now", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "now", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_4now(((PyTypeObject*)__pyx_v_cls)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_4now(PyTypeObject *__pyx_v_cls) { int64_t __pyx_v_value; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.now", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_value); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_15TimestampMicros_5now, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampMicros_now, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_now, __pyx_t_19) < 0) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros); __Pyx_GetNameInClass(__pyx_t_19, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_now); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = __Pyx_Method_ClassMethod(__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_now, __pyx_t_18) < 0) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros); __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_now, 442, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 442, __pyx_L1_error)
0443: def now(cls):
0444: """
0445: Construct a ``TimestampMicros`` from the current time as UTC.
0446: """
+0447: cdef int64_t value = line_sender_now_micros()
__pyx_v_value = line_sender_now_micros();
+0448: return cls(value)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0449:
+0450: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_5value___get__(((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_5value___get__(struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0451: def value(self) -> int:
0452: """Number of microseconds (Unix epoch timestamp, UTC)."""
+0453: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0454:
+0455: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_7__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_7__repr__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_6__repr__(((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_6__repr__(struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0456: return f'TimestampMicros.({self._value})'
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __Pyx_INCREF(__pyx_kp_u_TimestampMicros); __pyx_t_2 += 17; __Pyx_GIVEREF(__pyx_kp_u_TimestampMicros); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_TimestampMicros); __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__12); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__12); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__12); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
0457:
0458:
+0459: cdef class TimestampNanos:
struct __pyx_obj_7questdb_7ingress_TimestampNanos { PyObject_HEAD int64_t _value; };
0460: """
0461: A timestamp in nanoseconds since the UNIX epoch (UTC).
0462:
0463: You may construct a ``TimestampNanos`` from an integer or a
0464: ``datetime.datetime``, or simply call the :func:`TimestampNanos.now`
0465: method.
0466:
0467: .. code-block:: python
0468:
0469: # Recommended way to get the current timestamp.
0470: TimestampNanos.now()
0471:
0472: # The above is equivalent to:
0473: TimestampNanos(time.time_ns())
0474:
0475: # You can provide a numeric timestamp too. It can't be negative.
0476: TimestampNanos(1657888365426838016)
0477:
0478: ``TimestampNanos`` can also be constructed from a ``datetime`` object.
0479:
0480: .. code-block:: python
0481:
0482: TimestampNanos.from_datetime(
0483: datetime.datetime.now(tz=datetime.timezone.utc))
0484:
0485: We recommend that when using ``datetime`` objects, you explicitly pass in
0486: the timezone to use. This is because ``datetime`` objects without an
0487: associated timezone are assumed to be in the local timezone and it is easy
0488: to make mistakes (e.g. passing ``datetime.datetime.utcnow()`` is a likely
0489: bug).
0490: """
0491: cdef int64_t _value
0492:
+0493: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 493, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } __pyx_v_value = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 493, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyInt_Type), 0, "value", 1))) __PYX_ERR(0, 493, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos___cinit__(((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_14TimestampNanos___cinit__(struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0494: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0495: raise ValueError('value must be a positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 495, __pyx_L1_error)
+0496: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0497:
+0498: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_14TimestampNanos_2from_datetime, "\n Construct a ``TimestampNanos`` from a ``datetime.datetime`` object.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_14TimestampNanos_3from_datetime = {"from_datetime", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_14TimestampNanos_2from_datetime}; static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyDateTime_DateTime *__pyx_v_dt = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dt,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dt)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 498, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "from_datetime") < 0)) __PYX_ERR(0, 498, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_dt = ((PyDateTime_DateTime *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("from_datetime", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 498, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TimestampNanos.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 0, "dt", 0))) __PYX_ERR(0, 499, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_2from_datetime(((PyTypeObject*)__pyx_v_cls), __pyx_v_dt); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_dt, __pyx_n_s_datetime) < 0) __PYX_ERR(0, 498, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_14TimestampNanos_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampNanos_from_datetime, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_18); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_from_datetime, __pyx_t_19) < 0) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos); __Pyx_GetNameInClass(__pyx_t_19, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = __Pyx_Method_ClassMethod(__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_from_datetime, __pyx_t_18) < 0) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos); /* … */ __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_datetime, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 498, __pyx_L1_error)
0499: def from_datetime(cls, dt: datetime):
0500: """
0501: Construct a ``TimestampNanos`` from a ``datetime.datetime`` object.
0502: """
+0503: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = (!__pyx_t_1);
if (unlikely(__pyx_t_2)) {
/* … */
}
+0504: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 504, __pyx_L1_error)
+0505: return cls(datetime_to_nanos(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __pyx_f_7questdb_7ingress_datetime_to_nanos(__pyx_v_dt); if (unlikely(__pyx_t_4 == ((int64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
0506:
+0507: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5now(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_14TimestampNanos_4now, "\n Construct a ``TimestampNanos`` from the current time as UTC.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_14TimestampNanos_5now = {"now", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_14TimestampNanos_5now, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_14TimestampNanos_4now}; static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5now(PyObject *__pyx_v_cls, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("now (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("now", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "now", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_4now(((PyTypeObject*)__pyx_v_cls)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_4now(PyTypeObject *__pyx_v_cls) { int64_t __pyx_v_value; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.now", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_14TimestampNanos_5now, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampNanos_now, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_now, __pyx_t_18) < 0) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos); __Pyx_GetNameInClass(__pyx_t_18, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_now); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_19 = __Pyx_Method_ClassMethod(__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_now, __pyx_t_19) < 0) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos); /* … */ __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_now, 507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 507, __pyx_L1_error)
0508: def now(cls):
0509: """
0510: Construct a ``TimestampNanos`` from the current time as UTC.
0511: """
+0512: cdef int64_t value = line_sender_now_nanos()
__pyx_v_value = line_sender_now_nanos();
+0513: return cls(value)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0514:
+0515: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_5value___get__(((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_5value___get__(struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0516: def value(self) -> int:
0517: """Number of nanoseconds (Unix epoch timestamp, UTC)."""
+0518: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0519:
+0520: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_7__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_7__repr__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_6__repr__(((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_6__repr__(struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0521: return f'TimestampNanos({self.value})'
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __Pyx_INCREF(__pyx_kp_u_TimestampNanos); __pyx_t_2 += 15; __Pyx_GIVEREF(__pyx_kp_u_TimestampNanos); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_TimestampNanos); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__12); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__12); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__12); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
0522:
0523:
+0524: cdef class Sender
struct __pyx_obj_7questdb_7ingress_Sender { PyObject_HEAD struct __pyx_vtabstruct_7questdb_7ingress_Sender *__pyx_vtab; PyObject *__weakref__; enum line_sender_protocol _c_protocol; struct line_sender_opts *_opts; struct line_sender *_impl; struct __pyx_obj_7questdb_7ingress_Buffer *_buffer; struct __pyx_t_7questdb_7ingress_auto_flush_mode_t _auto_flush_mode; int64_t *_last_flush_ms; size_t _init_buf_size; size_t _max_name_len; int _in_txn; };
+0525: cdef class Buffer
struct __pyx_obj_7questdb_7ingress_Buffer { PyObject_HEAD struct __pyx_vtabstruct_7questdb_7ingress_Buffer *__pyx_vtab; struct line_sender_buffer *_impl; struct qdb_pystr_buf *_b; size_t _init_buf_size; size_t _max_name_len; PyObject *_row_complete_sender; };
0526:
0527:
+0528: cdef void_int may_flush_on_row_complete(Buffer buffer, Sender sender) except -1:
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_may_flush_on_row_complete(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer, struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_sender) { __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.may_flush_on_row_complete", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0529: if should_auto_flush(
__pyx_t_1 = __pyx_f_7questdb_7ingress_should_auto_flush((&__pyx_v_sender->_auto_flush_mode), __pyx_v_buffer->_impl, (__pyx_v_sender->_last_flush_ms[0])); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
0530: &sender._auto_flush_mode,
0531: buffer._impl,
0532: sender._last_flush_ms[0]):
+0533: sender.flush(buffer)
__pyx_t_3.__pyx_n = 1; __pyx_t_3.buffer = __pyx_v_buffer; __pyx_t_2 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_sender->__pyx_vtab)->flush(__pyx_v_sender, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0534:
0535:
+0536: cdef bint _is_tcp_protocol(line_sender_protocol protocol):
static int __pyx_f_7questdb_7ingress__is_tcp_protocol(enum line_sender_protocol __pyx_v_protocol) { int __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
0537: return (
+0538: (protocol == line_sender_protocol_tcp) or
switch (__pyx_v_protocol) { case line_sender_protocol_tcp: case line_sender_protocol_tcps: /* … */ __pyx_t_1 = 1; /* … */ break; default: __pyx_t_1 = 0; break; } __pyx_r = __pyx_t_1; goto __pyx_L0;
0539: (protocol == line_sender_protocol_tcps))
0540:
0541:
+0542: cdef bint _is_http_protocol(line_sender_protocol protocol):
static int __pyx_f_7questdb_7ingress__is_http_protocol(enum line_sender_protocol __pyx_v_protocol) { int __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
0543: return (
+0544: (protocol == line_sender_protocol_http) or
switch (__pyx_v_protocol) { case line_sender_protocol_http: case line_sender_protocol_https: /* … */ __pyx_t_1 = 1; /* … */ break; default: __pyx_t_1 = 0; break; } __pyx_r = __pyx_t_1; goto __pyx_L0;
0545: (protocol == line_sender_protocol_https))
0546:
0547:
+0548: cdef class SenderTransaction:
struct __pyx_obj_7questdb_7ingress_SenderTransaction { PyObject_HEAD struct __pyx_obj_7questdb_7ingress_Sender *_sender; PyObject *_table_name; int _complete; };
0549: """
0550: A transaction for a specific table.
0551:
0552: Transactions are not supported with ILP/TCP, only ILP/HTTP.
0553:
0554: The sender API can only operate on one transaction at a time.
0555:
0556: To create a transaction:
0557:
0558: .. code_block:: python
0559:
0560: with sender.transaction('table_name') as txn:
0561: txn.row(..)
0562: txn.dataframe(..)
0563: """
0564: cdef Sender _sender
0565: cdef str _table_name
0566: cdef bint _complete
0567:
+0568: def __cinit__(self, Sender sender, str table_name):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_17SenderTransaction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_17SenderTransaction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_sender = 0; PyObject *__pyx_v_table_name = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sender,&__pyx_n_s_table_name,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sender)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_name)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 568, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 568, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); } __pyx_v_sender = ((struct __pyx_obj_7questdb_7ingress_Sender *)values[0]); __pyx_v_table_name = ((PyObject*)values[1]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 568, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.SenderTransaction.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sender), __pyx_ptype_7questdb_7ingress_Sender, 1, "sender", 0))) __PYX_ERR(0, 568, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 568, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction___cinit__(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self), __pyx_v_sender, __pyx_v_table_name); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_17SenderTransaction___cinit__(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self, struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_sender, PyObject *__pyx_v_table_name) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0569: if _is_tcp_protocol(sender._c_protocol):
__pyx_t_1 = __pyx_f_7questdb_7ingress__is_tcp_protocol(__pyx_v_sender->_c_protocol); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+0570: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+0571: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_Transactions_aren_t_supported_fo}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 570, __pyx_L1_error)
0572: "Transactions aren't supported for ILP/TCP, " +
0573: "use ILP/HTTP instead.")
+0574: self._sender = sender
__Pyx_INCREF((PyObject *)__pyx_v_sender); __Pyx_GIVEREF((PyObject *)__pyx_v_sender); __Pyx_GOTREF((PyObject *)__pyx_v_self->_sender); __Pyx_DECREF((PyObject *)__pyx_v_self->_sender); __pyx_v_self->_sender = __pyx_v_sender;
+0575: self._table_name = table_name
__Pyx_INCREF(__pyx_v_table_name); __Pyx_GIVEREF(__pyx_v_table_name); __Pyx_GOTREF(__pyx_v_self->_table_name); __Pyx_DECREF(__pyx_v_self->_table_name); __pyx_v_self->_table_name = __pyx_v_table_name;
+0576: self._complete = False
__pyx_v_self->_complete = 0;
0577:
+0578: def __enter__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_3__enter__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_3__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_3__enter__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_2__enter__(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_2__enter__(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction___enter, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_enter, __pyx_t_19) < 0) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); /* … */ __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_enter, 578, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 578, __pyx_L1_error)
+0579: if self._sender._in_txn:
if (unlikely(__pyx_v_self->_sender->_in_txn)) { /* … */ }
+0580: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0581: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_kp_u_Already_inside_a_transaction_can}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 580, __pyx_L1_error)
0582: 'Already inside a transaction, can\'t start another.')
+0583: if len(self._sender._buffer):
__pyx_t_1 = ((PyObject *)__pyx_v_self->_sender->_buffer); __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { /* … */ }
+0584: if self._sender._auto_flush_mode.enabled:
if (likely(__pyx_v_self->_sender->_auto_flush_mode.enabled)) { /* … */ goto __pyx_L5; }
+0585: self._sender.flush()
__pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->_sender->__pyx_vtab)->flush(__pyx_v_self->_sender, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0586: else:
+0587: raise IngressError(
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0588: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_kp_u_Sender_buffer_must_be_clear_when}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 587, __pyx_L1_error) } __pyx_L5:;
0589: 'Sender buffer must be clear when starting a ' +
0590: 'transaction. You must call `.flush()` before this call.')
+0591: self._sender._in_txn = True
__pyx_v_self->_sender->_in_txn = 1;
+0592: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
0593:
+0594: def __exit__(self, exc_type, _exc_value, _traceback):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_5__exit__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_5__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_5__exit__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_exc_type = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_value = 0; CYTHON_UNUSED PyObject *__pyx_v__traceback = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_value,&__pyx_n_s_traceback,0}; PyObject* values[3] = {0,0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_value)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 594, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_traceback)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 594, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(0, 594, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } __pyx_v_exc_type = values[0]; __pyx_v__exc_value = values[1]; __pyx_v__traceback = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 594, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.SenderTransaction.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_4__exit__(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self), __pyx_v_exc_type, __pyx_v__exc_value, __pyx_v__traceback); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_4__exit__(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v__exc_value, CYTHON_UNUSED PyObject *__pyx_v__traceback) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__64 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__64); __Pyx_GIVEREF(__pyx_tuple__64); /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction___exit, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_exit, __pyx_t_19) < 0) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_exit, 594, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 594, __pyx_L1_error)
+0595: if exc_type is not None:
__pyx_t_1 = (__pyx_v_exc_type != Py_None); if (__pyx_t_1) { /* … */ }
+0596: if not self._complete:
__pyx_t_1 = (!__pyx_v_self->_complete); if (__pyx_t_1) { /* … */ }
+0597: self.rollback()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rollback); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0598: return False
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; goto __pyx_L0;
0599: else:
+0600: if not self._complete:
/*else*/ { __pyx_t_1 = (!__pyx_v_self->_complete); if (__pyx_t_1) { /* … */ }
+0601: self.commit()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_commit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0602: return True
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0; }
0603:
+0604: def row(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_7row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_17SenderTransaction_6row, "\n Write a row for the table in the transaction.\n\n The table name is taken from the transaction.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_7row = {"row", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_7row, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_17SenderTransaction_6row}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_7row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_at,&__pyx_n_s_symbols,&__pyx_n_s_columns,0}; PyObject* values[3] = {0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_6row(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__66 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_symbols, __pyx_n_s_columns, __pyx_n_s_at); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__66); __Pyx_GIVEREF(__pyx_tuple__66); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_symbols, __pyx_kp_s_Optional_Dict_str_Optional_str) < 0) __PYX_ERR(0, 604, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_columns, __pyx_kp_s_Optional_Dict_str_Union_None_boo) < 0) __PYX_ERR(0, 604, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_at, __pyx_kp_s_Union_ServerTimestamp_TimestampN) < 0) __PYX_ERR(0, 604, __pyx_L1_error) __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_7row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction_row, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_20, __pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_18); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_row, __pyx_t_20) < 0) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_row, 604, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 604, __pyx_L1_error)
0605: self,
0606: *,
+0607: symbols: Optional[Dict[str, Optional[str]]]=None,
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_symbols, Py_None) < 0) __PYX_ERR(0, 604, __pyx_L1_error)
0608: columns: Optional[Dict[
0609: str,
0610: Union[None, bool, int, float, str, TimestampMicros, datetime]]
+0611: ]=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 604, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 604, __pyx_L3_error) } if (kw_args > 0 && likely(kw_args <= 2)) { Py_ssize_t index; for (index = 1; index < 3 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 604, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "row") < 0)) __PYX_ERR(0, 604, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 0)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 604, __pyx_L3_error) } __pyx_v_at = values[0]; __pyx_v_symbols = ((PyObject*)values[1]); __pyx_v_columns = ((PyObject*)values[2]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 604, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.SenderTransaction.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_symbols), (&PyDict_Type), 1, "symbols", 1))) __PYX_ERR(0, 607, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyDict_Type), 1, "columns", 1))) __PYX_ERR(0, 608, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_6row(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self), __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_columns, Py_None) < 0) __PYX_ERR(0, 604, __pyx_L1_error)
0612: at: Union[ServerTimestamp, TimestampNanos, datetime]):
0613: """
0614: Write a row for the table in the transaction.
0615:
0616: The table name is taken from the transaction.
0617: """
+0618: if at is None:
__pyx_t_1 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_1)) { /* … */ }
+0619: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+0620: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 619, __pyx_L1_error)
0621: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
0622: )
+0623: self._sender._buffer._row(
__pyx_t_8.__pyx_n = 3; __pyx_t_8.symbols = __pyx_v_symbols; __pyx_t_8.columns = __pyx_v_columns; __pyx_t_8.at = __pyx_v_at; __pyx_t_7 = ((struct __pyx_vtabstruct_7questdb_7ingress_Buffer *)__pyx_v_self->_sender->_buffer->__pyx_vtab)->_row(__pyx_v_self->_sender->_buffer, 0, ((PyObject*)__pyx_t_2), &__pyx_t_8); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0624: False, # allow_auto_flush
+0625: self._table_name,
__pyx_t_2 = __pyx_v_self->_table_name;
__Pyx_INCREF(__pyx_t_2);
0626: symbols=symbols,
0627: columns=columns,
0628: at=at)
+0629: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
0630:
+0631: def dataframe(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_9dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_17SenderTransaction_8dataframe, "\n Write a dataframe for the table in the transaction.\n\n The table name is taken from the transaction.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_9dataframe = {"dataframe", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_9dataframe, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_17SenderTransaction_8dataframe}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_9dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dataframe (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_at,&__pyx_n_s_symbols,0}; PyObject* values[3] = {0,0,0}; values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_auto)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 631, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 631, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 631, __pyx_L3_error) } } if (kw_args == 1) { const Py_ssize_t index = 2; PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 631, __pyx_L3_error) } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dataframe") < 0)) __PYX_ERR(0, 631, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 631, __pyx_L3_error) } __pyx_v_df = values[0]; __pyx_v_at = values[1]; __pyx_v_symbols = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("dataframe", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 631, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.SenderTransaction.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_8dataframe(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self), __pyx_v_df, __pyx_v_symbols, __pyx_v_at); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_8dataframe(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_symbols, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__68 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_df, __pyx_n_s_symbols, __pyx_n_s_at); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__68); __Pyx_GIVEREF(__pyx_tuple__68); /* … */ __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_symbols, __pyx_n_u_auto) < 0) __PYX_ERR(0, 631, __pyx_L1_error) __pyx_t_18 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_symbols, __pyx_kp_s_Union_str_bool_List_int_List_str) < 0) __PYX_ERR(0, 631, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_at, __pyx_kp_s_Union_ServerTimestamp_int_str_Ti) < 0) __PYX_ERR(0, 631, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_9dataframe, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction_dataframe, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_19, __pyx_t_20); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_18); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_dataframe, __pyx_t_19) < 0) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_dataframe, 631, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 631, __pyx_L1_error)
0632: self,
0633: df, # : pd.DataFrame
0634: *,
0635: symbols: Union[str, bool, List[int], List[str]] = 'auto',
0636: at: Union[ServerTimestamp, int, str, TimestampNanos, datetime]):
0637: """
0638: Write a dataframe for the table in the transaction.
0639:
0640: The table name is taken from the transaction.
0641: """
+0642: if at is None:
__pyx_t_1 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_1)) { /* … */ }
+0643: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+0644: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 643, __pyx_L1_error)
0645: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
0646: )
+0647: _dataframe(
__pyx_t_7 = __pyx_f_7questdb_7ingress__dataframe(__pyx_f_7questdb_7ingress_auto_flush_blank(), __pyx_v_self->_sender->_buffer->_impl, __pyx_v_self->_sender->_buffer->_b, __pyx_v_df, __pyx_t_2, Py_None, __pyx_v_symbols, __pyx_v_at); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0648: auto_flush_blank(),
0649: self._sender._buffer._impl,
0650: self._sender._buffer._b,
0651: df,
+0652: self._table_name,
__pyx_t_2 = __pyx_v_self->_table_name;
__Pyx_INCREF(__pyx_t_2);
0653: None, # table_name_col,
0654: symbols,
0655: at)
+0656: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
0657:
+0658: def commit(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_11commit(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_17SenderTransaction_10commit, "\n Commit the transaction.\n \n A commit is also automatic at the end of a successful `with` block.\n\n This will flush the buffer.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_11commit = {"commit", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_11commit, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_17SenderTransaction_10commit}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_11commit(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("commit (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("commit", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "commit", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_10commit(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_10commit(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.commit", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_11commit, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction_commit, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_commit, __pyx_t_19) < 0) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); /* … */ __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_commit, 658, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 658, __pyx_L1_error)
0659: """
0660: Commit the transaction.
0661:
0662: A commit is also automatic at the end of a successful `with` block.
0663:
0664: This will flush the buffer.
0665: """
+0666: if self._complete:
if (unlikely(__pyx_v_self->_complete)) { /* … */ }
+0667: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0668: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_kp_u_Transaction_already_completed_ca}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 667, __pyx_L1_error)
0669: 'Transaction already completed, can\'t commit')
+0670: self._sender._in_txn = False
__pyx_v_self->_sender->_in_txn = 0;
+0671: self._complete = True
__pyx_v_self->_complete = 1;
+0672: if len(self._sender._buffer):
__pyx_t_1 = ((PyObject *)__pyx_v_self->_sender->_buffer); __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 672, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { /* … */ }
+0673: self._sender.flush(transactional=True)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_sender), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_transactional, Py_True) < 0) __PYX_ERR(0, 673, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0674:
+0675: def rollback(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_13rollback(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_17SenderTransaction_12rollback, "\n Roll back the transaction.\n\n A rollback is also automatic at the end of a failed `with` block.\n\n This will clear the buffer.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_17SenderTransaction_13rollback = {"rollback", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_17SenderTransaction_13rollback, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_17SenderTransaction_12rollback}; static PyObject *__pyx_pw_7questdb_7ingress_17SenderTransaction_13rollback(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rollback (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("rollback", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rollback", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_17SenderTransaction_12rollback(((struct __pyx_obj_7questdb_7ingress_SenderTransaction *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_17SenderTransaction_12rollback(struct __pyx_obj_7questdb_7ingress_SenderTransaction *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.SenderTransaction.rollback", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_17SenderTransaction_13rollback, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SenderTransaction_rollback, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction, __pyx_n_s_rollback, __pyx_t_19) < 0) __PYX_ERR(0, 675, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_SenderTransaction); /* … */ __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_rollback, 675, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 675, __pyx_L1_error)
0676: """
0677: Roll back the transaction.
0678:
0679: A rollback is also automatic at the end of a failed `with` block.
0680:
0681: This will clear the buffer.
0682: """
+0683: if self._complete:
if (unlikely(__pyx_v_self->_complete)) { /* … */ }
+0684: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0685: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_kp_u_Transaction_already_completed_ca_2}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 684, __pyx_L1_error)
0686: 'Transaction already completed, can\'t rollback.')
+0687: self._sender._buffer.clear()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_sender->_buffer), __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0688: self._sender._in_txn = False
__pyx_v_self->_sender->_in_txn = 0;
+0689: self._complete = True
__pyx_v_self->_complete = 1;
0690:
0691:
+0692: cdef class Buffer:
struct __pyx_vtabstruct_7questdb_7ingress_Buffer { PyObject *(*_cinit_impl)(struct __pyx_obj_7questdb_7ingress_Buffer *, size_t, size_t); PyObject *(*_to_str)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_set_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_rewind_to_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); PyObject *(*_clear_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_table)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *); struct qdb_pystr_buf *(*_cleared_b)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_symbol)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *, PyObject *); __pyx_t_7questdb_7ingress_void_int (*_column_bool)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, int); __pyx_t_7questdb_7ingress_void_int (*_column_i64)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, int64_t); __pyx_t_7questdb_7ingress_void_int (*_column_f64)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, double); __pyx_t_7questdb_7ingress_void_int (*_column_str)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, PyObject *); __pyx_t_7questdb_7ingress_void_int (*_column_ts)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, struct __pyx_obj_7questdb_7ingress_TimestampMicros *); __pyx_t_7questdb_7ingress_void_int (*_column_dt)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, PyDateTime_DateTime *); __pyx_t_7questdb_7ingress_void_int (*_column)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *, PyObject *); __pyx_t_7questdb_7ingress_void_int (*_may_trigger_row_complete)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_at_ts)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct __pyx_obj_7questdb_7ingress_TimestampNanos *); __pyx_t_7questdb_7ingress_void_int (*_at_dt)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyDateTime_DateTime *); __pyx_t_7questdb_7ingress_void_int (*_at_now)(struct __pyx_obj_7questdb_7ingress_Buffer *); __pyx_t_7questdb_7ingress_void_int (*_at)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *); __pyx_t_7questdb_7ingress_void_int (*_row)(struct __pyx_obj_7questdb_7ingress_Buffer *, int, PyObject *, struct __pyx_opt_args_7questdb_7ingress_6Buffer__row *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_7ingress_Buffer *__pyx_vtabptr_7questdb_7ingress_Buffer;
0693: """
0694: Construct QuestDB-flavored InfluxDB Line Protocol (ILP) messages.
0695:
0696: The :func:`Buffer.row` method is used to add a row to the buffer.
0697:
0698: You can call this many times.
0699:
0700: .. code-block:: python
0701:
0702: from questdb.ingress import Buffer
0703:
0704: buf = Buffer()
0705: buf.row(
0706: 'table_name1',
0707: symbols={'s1', 'v1', 's2', 'v2'},
0708: columns={'c1': True, 'c2': 0.5})
0709:
0710: buf.row(
0711: 'table_name2',
0712: symbols={'questdb': '❤️'},
0713: columns={'like': 100000})
0714:
0715: # Append any additional rows then, once ready, call
0716: sender.flush(buffer) # a `Sender` instance.
0717:
0718: # The sender auto-cleared the buffer, ready for reuse.
0719:
0720: buf.row(
0721: 'table_name1',
0722: symbols={'s1', 'v1', 's2', 'v2'},
0723: columns={'c1': True, 'c2': 0.5})
0724:
0725: # etc.
0726:
0727:
0728: Buffer Constructor Arguments:
0729: * ``init_buf_size`` (``int``): Initial capacity of the buffer in bytes.
0730: Defaults to ``65536`` (64KiB).
0731: * ``max_name_len`` (``int``): Maximum length of a column name.
0732: Defaults to ``127`` which is the same default value as QuestDB.
0733: This should match the ``cairo.max.file.name.length`` setting of the
0734: QuestDB instance you're connecting to.
0735:
0736: .. code-block:: python
0737:
0738: # These two buffer constructions are equivalent.
0739: buf1 = Buffer()
0740: buf2 = Buffer(init_buf_size=65536, max_name_len=127)
0741:
0742: To avoid having to manually set these arguments every time, you can call
0743: the sender's ``new_buffer()`` method instead.
0744:
0745: .. code-block:: python
0746:
0747: from questdb.ingress import Sender, Buffer
0748:
0749: sender = Sender('http', 'localhost', 9009,
0750: init_buf_size=16384, max_name_len=64)
0751: buf = sender.new_buffer()
0752: assert buf.init_buf_size == 16384
0753: assert buf.max_name_len == 64
0754:
0755: """
0756: cdef line_sender_buffer* _impl
0757: cdef qdb_pystr_buf* _b
0758: cdef size_t _init_buf_size
0759: cdef size_t _max_name_len
0760: cdef object _row_complete_sender
0761:
+0762: def __cinit__(self, init_buf_size: int=65536, max_name_len: int=127):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_init_buf_size = 0; PyObject *__pyx_v_max_name_len = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_init_buf_size,&__pyx_n_s_max_name_len,0}; PyObject* values[2] = {0,0}; values[0] = __Pyx_Arg_NewRef_VARARGS(__pyx_k__32); values[1] = __Pyx_Arg_NewRef_VARARGS(__pyx_k__33); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_init_buf_size); if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_name_len); if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 762, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_init_buf_size = ((PyObject*)values[0]); __pyx_v_max_name_len = ((PyObject*)values[1]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 762, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_init_buf_size), (&PyInt_Type), 0, "init_buf_size", 1))) __PYX_ERR(0, 762, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_max_name_len), (&PyInt_Type), 0, "max_name_len", 1))) __PYX_ERR(0, 762, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer___cinit__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_init_buf_size, __pyx_v_max_name_len); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_6Buffer___cinit__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_init_buf_size, PyObject *__pyx_v_max_name_len) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_65536)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_65536))) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_INCREF(__pyx_int_65536); __pyx_k__32 = ((PyObject*)__pyx_int_65536); __Pyx_GIVEREF(__pyx_int_65536); if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_127)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_127))) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_INCREF(__pyx_int_127); __pyx_k__33 = ((PyObject*)__pyx_int_127); __Pyx_GIVEREF(__pyx_int_127);
0763: """
0764: Create a new buffer with the an initial capacity and max name length.
0765: :param int init_buf_size: Initial capacity of the buffer in bytes.
0766: :param int max_name_len: Maximum length of a table or column name.
0767: """
+0768: self._cinit_impl(init_buf_size, max_name_len)
__pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_init_buf_size); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_v_max_name_len); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__cinit_impl(__pyx_v_self, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0769:
+0770: cdef inline _cinit_impl(self, size_t init_buf_size, size_t max_name_len):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__cinit_impl(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, size_t __pyx_v_init_buf_size, size_t __pyx_v_max_name_len) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0771: self._impl = line_sender_buffer_with_max_name_len(max_name_len)
__pyx_v_self->_impl = line_sender_buffer_with_max_name_len(__pyx_v_max_name_len);
+0772: self._b = qdb_pystr_buf_new()
__pyx_v_self->_b = qdb_pystr_buf_new();
+0773: line_sender_buffer_reserve(self._impl, init_buf_size)
line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_v_init_buf_size);
+0774: self._init_buf_size = init_buf_size
__pyx_v_self->_init_buf_size = __pyx_v_init_buf_size;
+0775: self._max_name_len = max_name_len
__pyx_v_self->_max_name_len = __pyx_v_max_name_len;
+0776: self._row_complete_sender = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_row_complete_sender); __pyx_v_self->_row_complete_sender = Py_None;
0777:
+0778: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_7ingress_6Buffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_7ingress_6Buffer_3__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_7questdb_7ingress_6Buffer_2__dealloc__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_7ingress_6Buffer_2__dealloc__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+0779: self._row_complete_sender = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_row_complete_sender); __pyx_v_self->_row_complete_sender = Py_None;
+0780: qdb_pystr_buf_free(self._b)
qdb_pystr_buf_free(__pyx_v_self->_b);
+0781: line_sender_buffer_free(self._impl)
line_sender_buffer_free(__pyx_v_self->_impl);
0782:
+0783: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13init_buf_size_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13init_buf_size_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_13init_buf_size___get__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_13init_buf_size___get__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.init_buf_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0784: def init_buf_size(self) -> int:
0785: """
0786: The initial capacity of the buffer when first created.
0787:
0788: This may grow over time, see ``capacity()``.
0789: """
+0790: return self._init_buf_size
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_buf_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0791:
+0792: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_12max_name_len_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_12max_name_len_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_12max_name_len___get__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_12max_name_len___get__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.max_name_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0793: def max_name_len(self) -> int:
0794: """Maximum length of a table or column name."""
+0795: return self._max_name_len
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0796:
+0797: def reserve(self, additional: int):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_5reserve(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_4reserve, "\n Ensure the buffer has at least `additional` bytes of future capacity.\n\n :param int additional: Additional bytes to reserve.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_5reserve = {"reserve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_5reserve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_4reserve}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_5reserve(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_additional = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reserve (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_additional,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_additional)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 797, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "reserve") < 0)) __PYX_ERR(0, 797, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_additional = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("reserve", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 797, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Buffer.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_additional), (&PyInt_Type), 0, "additional", 1))) __PYX_ERR(0, 797, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_4reserve(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_additional); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_4reserve(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_additional) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__74 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_additional); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__74); __Pyx_GIVEREF(__pyx_tuple__74); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_additional, __pyx_n_s_int) < 0) __PYX_ERR(0, 797, __pyx_L1_error) __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_5reserve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_reserve, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_18, __pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer, __pyx_n_s_reserve, __pyx_t_18) < 0) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_reserve, 797, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 797, __pyx_L1_error)
0798: """
0799: Ensure the buffer has at least `additional` bytes of future capacity.
0800:
0801: :param int additional: Additional bytes to reserve.
0802: """
+0803: if additional < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_additional, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 803, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0804: raise ValueError('additional must be non-negative.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 804, __pyx_L1_error) /* … */ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_u_additional_must_be_non_negative); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34);
+0805: line_sender_buffer_reserve(self._impl, additional)
__pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_additional); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error) line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_t_3);
0806:
+0807: def capacity(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_7capacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_6capacity, "The current buffer capacity."); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_7capacity = {"capacity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_7capacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_6capacity}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_7capacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("capacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("capacity", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "capacity", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_6capacity(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_6capacity(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 807, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_7capacity, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_capacity, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_18); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer, __pyx_n_s_capacity, __pyx_t_19) < 0) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); /* … */ __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_capacity, 807, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 807, __pyx_L1_error)
0808: """The current buffer capacity."""
+0809: return line_sender_buffer_capacity(self._impl)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(line_sender_buffer_capacity(__pyx_v_self->_impl)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(0, 809, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
0810:
+0811: def clear(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_9clear(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_8clear, "\n Reset the buffer.\n\n Note that flushing a buffer will (unless otherwise specified)\n also automatically clear it.\n\n This method is designed to be called only in conjunction with\n ``sender.flush(buffer, clear=False)``.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_9clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_9clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_8clear}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_9clear(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_8clear(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_8clear(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_9clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_clear, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer, __pyx_n_s_clear, __pyx_t_19) < 0) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); /* … */ __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_clear, 811, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 811, __pyx_L1_error)
0812: """
0813: Reset the buffer.
0814:
0815: Note that flushing a buffer will (unless otherwise specified)
0816: also automatically clear it.
0817:
0818: This method is designed to be called only in conjunction with
0819: ``sender.flush(buffer, clear=False)``.
0820: """
+0821: line_sender_buffer_clear(self._impl)
line_sender_buffer_clear(__pyx_v_self->_impl);
+0822: qdb_pystr_buf_clear(self._b)
qdb_pystr_buf_clear(__pyx_v_self->_b);
0823:
+0824: def __len__(self) -> int:
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_7ingress_6Buffer_11__len__(PyObject *__pyx_v_self); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_10__len__, "\n The current number of bytes currently in the buffer.\n\n Equivalent (but cheaper) to ``len(str(sender))``.\n "); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Buffer_10__len__; #endif static Py_ssize_t __pyx_pw_7questdb_7ingress_6Buffer_11__len__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_10__len__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_7ingress_6Buffer_10__len__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { Py_ssize_t __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
0825: """
0826: The current number of bytes currently in the buffer.
0827:
0828: Equivalent (but cheaper) to ``len(str(sender))``.
0829: """
+0830: return line_sender_buffer_size(self._impl)
__pyx_r = line_sender_buffer_size(__pyx_v_self->_impl); goto __pyx_L0;
0831:
+0832: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13__str__(PyObject *__pyx_v_self); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_12__str__, "Return the constructed buffer as a string. Use for debugging."); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Buffer_12__str__; #endif static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13__str__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_12__str__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_12__str__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0833: """Return the constructed buffer as a string. Use for debugging."""
+0834: return self._to_str()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__to_str(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0835:
+0836: cdef inline object _to_str(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__to_str(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { size_t __pyx_v_size; char const *__pyx_v_utf8; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0837: cdef size_t size = 0
__pyx_v_size = 0;
+0838: cdef const char* utf8 = line_sender_buffer_peek(self._impl, &size)
__pyx_v_utf8 = line_sender_buffer_peek(__pyx_v_self->_impl, (&__pyx_v_size));
+0839: return PyUnicode_FromStringAndSize(utf8, <Py_ssize_t>size)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_utf8, ((Py_ssize_t)__pyx_v_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0840:
+0841: cdef inline void_int _set_marker(self) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__set_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._set_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0842: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0843: if not line_sender_buffer_set_marker(self._impl, &err):
__pyx_t_1 = (!line_sender_buffer_set_marker(__pyx_v_self->_impl, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0844: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 844, __pyx_L1_error)
0845:
+0846: cdef inline void_int _rewind_to_marker(self) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._rewind_to_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0847: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0848: if not line_sender_buffer_rewind_to_marker(self._impl, &err):
__pyx_t_1 = (!line_sender_buffer_rewind_to_marker(__pyx_v_self->_impl, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0849: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 849, __pyx_L1_error)
0850:
+0851: cdef inline _clear_marker(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__clear_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0852: line_sender_buffer_clear_marker(self._impl)
line_sender_buffer_clear_marker(__pyx_v_self->_impl);
0853:
+0854: cdef inline void_int _table(self, str table_name) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__table(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name) { struct line_sender_error *__pyx_v_err; struct line_sender_table_name __pyx_v_c_table_name; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Buffer._table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0855: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0856: cdef line_sender_table_name c_table_name
+0857: str_to_table_name(
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_table_name(__pyx_t_1, ((PyObject *)__pyx_v_table_name), (&__pyx_v_c_table_name)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 857, __pyx_L1_error)
+0858: self._cleared_b(), <PyObject*>table_name, &c_table_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__cleared_b(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L1_error)
+0859: if not line_sender_buffer_table(self._impl, c_table_name, &err):
__pyx_t_3 = (!line_sender_buffer_table(__pyx_v_self->_impl, __pyx_v_c_table_name, (&__pyx_v_err))); if (unlikely(__pyx_t_3)) { /* … */ }
+0860: raise c_err_to_py(err)
__pyx_t_4 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 860, __pyx_L1_error)
0861:
+0862: cdef inline qdb_pystr_buf* _cleared_b(self):
static CYTHON_INLINE struct qdb_pystr_buf *__pyx_f_7questdb_7ingress_6Buffer__cleared_b(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct qdb_pystr_buf *__pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
+0863: qdb_pystr_buf_clear(self._b)
qdb_pystr_buf_clear(__pyx_v_self->_b);
+0864: return self._b
__pyx_r = __pyx_v_self->_b; goto __pyx_L0;
0865:
+0866: cdef inline void_int _symbol(self, str name, str value) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__symbol(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_column_name __pyx_v_c_name; struct line_sender_utf8 __pyx_v_c_value; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Buffer._symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0867: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0868: cdef line_sender_column_name c_name
0869: cdef line_sender_utf8 c_value
+0870: str_to_column_name(self._cleared_b(), name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__cleared_b(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 870, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_column_name(__pyx_t_1, __pyx_v_name, (&__pyx_v_c_name)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 870, __pyx_L1_error)
+0871: str_to_utf8(self._b, <PyObject*>value, &c_value)
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_self->_b, ((PyObject *)__pyx_v_value), (&__pyx_v_c_value)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 871, __pyx_L1_error)
+0872: if not line_sender_buffer_symbol(self._impl, c_name, c_value, &err):
__pyx_t_3 = (!line_sender_buffer_symbol(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err))); if (unlikely(__pyx_t_3)) { /* … */ }
+0873: raise c_err_to_py(err)
__pyx_t_4 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 873, __pyx_L1_error)
0874:
+0875: cdef inline void_int _column_bool(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_bool(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int __pyx_v_value) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_bool", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0876: self, line_sender_column_name c_name, bint value) except -1:
+0877: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0878: if not line_sender_buffer_column_bool(self._impl, c_name, value, &err):
__pyx_t_1 = (!line_sender_buffer_column_bool(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0879: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 879, __pyx_L1_error)
0880:
+0881: cdef inline void_int _column_i64(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_i64(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int64_t __pyx_v_value) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_i64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0882: self, line_sender_column_name c_name, int64_t value) except -1:
+0883: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0884: if not line_sender_buffer_column_i64(self._impl, c_name, value, &err):
__pyx_t_1 = (!line_sender_buffer_column_i64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0885: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 885, __pyx_L1_error)
+0886: return 0
__pyx_r = 0; goto __pyx_L0;
0887:
+0888: cdef inline void_int _column_f64(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_f64(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, double __pyx_v_value) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_f64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0889: self, line_sender_column_name c_name, double value) except -1:
+0890: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0891: if not line_sender_buffer_column_f64(self._impl, c_name, value, &err):
__pyx_t_1 = (!line_sender_buffer_column_f64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0892: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 892, __pyx_L1_error)
0893:
+0894: cdef inline void_int _column_str(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_str(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_c_value; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Buffer._column_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0895: self, line_sender_column_name c_name, str value) except -1:
+0896: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0897: cdef line_sender_utf8 c_value
+0898: str_to_utf8(self._b, <PyObject*>value, &c_value)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_self->_b, ((PyObject *)__pyx_v_value), (&__pyx_v_c_value)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 898, __pyx_L1_error)
+0899: if not line_sender_buffer_column_str(self._impl, c_name, c_value, &err):
__pyx_t_2 = (!line_sender_buffer_column_str(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0900: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 900, __pyx_L1_error)
0901:
+0902: cdef inline void_int _column_ts(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_ts(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0903: self, line_sender_column_name c_name, TimestampMicros ts) except -1:
+0904: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0905: if not line_sender_buffer_column_ts_micros(self._impl, c_name, ts._value, &err):
__pyx_t_1 = (!line_sender_buffer_column_ts_micros(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_ts->_value, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0906: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 906, __pyx_L1_error)
0907:
+0908: cdef inline void_int _column_dt(
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column_dt(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyDateTime_DateTime *__pyx_v_dt) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Buffer._column_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0909: self, line_sender_column_name c_name, datetime dt) except -1:
+0910: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0911: if not line_sender_buffer_column_ts_micros(
__pyx_t_2 = (!line_sender_buffer_column_ts_micros(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_t_1, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0912: self._impl, c_name, datetime_to_micros(dt), &err):
__pyx_t_1 = __pyx_f_7questdb_7ingress_datetime_to_micros(__pyx_v_dt); if (unlikely(__pyx_t_1 == ((int64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L1_error)
+0913: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 913, __pyx_L1_error)
0914:
+0915: cdef inline void_int _column(self, str name, object value) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__column(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_column_name __pyx_v_c_name; PyObject *__pyx_v_valid = NULL; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("questdb.ingress.Buffer._column", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_valid); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0916: cdef line_sender_column_name c_name
+0917: str_to_column_name(self._cleared_b(), name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__cleared_b(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 917, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_column_name(__pyx_t_1, __pyx_v_name, (&__pyx_v_c_name)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 917, __pyx_L1_error)
+0918: if PyBool_Check(<PyObject*>value):
__pyx_t_3 = PyBool_Check(((PyObject *)__pyx_v_value));
if (__pyx_t_3) {
/* … */
goto __pyx_L3;
}
+0919: self._column_bool(c_name, value)
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_bool(__pyx_v_self, __pyx_v_c_name, __pyx_t_3); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 919, __pyx_L1_error)
+0920: elif PyLong_CheckExact(<PyObject*>value):
__pyx_t_3 = PyLong_CheckExact(((PyObject *)__pyx_v_value));
if (__pyx_t_3) {
/* … */
goto __pyx_L3;
}
+0921: self._column_i64(c_name, value)
__pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 921, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_i64(__pyx_v_self, __pyx_v_c_name, __pyx_t_4); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 921, __pyx_L1_error)
+0922: elif PyFloat_CheckExact(<PyObject*>value):
__pyx_t_3 = PyFloat_CheckExact(((PyObject *)__pyx_v_value));
if (__pyx_t_3) {
/* … */
goto __pyx_L3;
}
+0923: self._column_f64(c_name, value)
__pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_f64(__pyx_v_self, __pyx_v_c_name, __pyx_t_5); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 923, __pyx_L1_error)
+0924: elif PyUnicode_CheckExact(<PyObject*>value):
__pyx_t_3 = PyUnicode_CheckExact(((PyObject *)__pyx_v_value));
if (__pyx_t_3) {
/* … */
goto __pyx_L3;
}
+0925: self._column_str(c_name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_value))) __PYX_ERR(0, 925, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_str(__pyx_v_self, __pyx_v_c_name, ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 925, __pyx_L1_error)
+0926: elif isinstance(value, TimestampMicros):
__pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7questdb_7ingress_TimestampMicros);
if (__pyx_t_3) {
/* … */
goto __pyx_L3;
}
+0927: self._column_ts(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7questdb_7ingress_TimestampMicros))))) __PYX_ERR(0, 927, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_ts(__pyx_v_self, __pyx_v_c_name, ((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_value)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 927, __pyx_L1_error)
+0928: elif isinstance(value, datetime):
__pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime);
if (likely(__pyx_t_3)) {
/* … */
goto __pyx_L3;
}
+0929: self._column_dt(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 929, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__column_dt(__pyx_v_self, __pyx_v_c_name, ((PyDateTime_DateTime *)__pyx_v_value)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 929, __pyx_L1_error)
0930: else:
+0931: valid = ', '.join((
/*else*/ { /* … */ __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__4, __pyx_tuple__35); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_valid = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+0932: 'bool',
__pyx_tuple__35 = PyTuple_Pack(6, __pyx_n_u_bool, __pyx_n_u_int, __pyx_n_u_float, __pyx_n_u_str, __pyx_n_u_TimestampMicros_2, __pyx_kp_u_datetime_datetime); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35);
0933: 'int',
0934: 'float',
0935: 'str',
0936: 'TimestampMicros',
0937: 'datetime.datetime'))
+0938: raise TypeError(
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 938, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 938, __pyx_L1_error) } __pyx_L3:;
+0939: f'Unsupported type: {_fqn(type(value))}. Must be one of: {valid}')
__pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Unsupported_type); __pyx_t_9 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_value)))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_10); __pyx_t_10 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_v_valid); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_6, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
0940:
+0941: cdef inline void_int _may_trigger_row_complete(self) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { CYTHON_UNUSED struct line_sender_error *__pyx_v_err; PyObject *__pyx_v_sender; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._may_trigger_row_complete", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0942: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0943: cdef PyObject* sender = NULL
__pyx_v_sender = NULL;
+0944: if self._row_complete_sender != None:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_self->_row_complete_sender, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 944, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+0945: sender = PyWeakref_GetObject(self._row_complete_sender)
__pyx_t_1 = __pyx_v_self->_row_complete_sender; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = PyWeakref_GetObject(__pyx_t_1); if (unlikely(__pyx_t_3 == ((PyObject *)NULL))) __PYX_ERR(0, 945, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sender = __pyx_t_3;
+0946: if sender != NULL:
__pyx_t_2 = (__pyx_v_sender != NULL); if (__pyx_t_2) { /* … */ }
+0947: may_flush_on_row_complete(self, <Sender><object>sender)
__pyx_t_4 = __pyx_f_7questdb_7ingress_may_flush_on_row_complete(__pyx_v_self, ((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_sender)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 947, __pyx_L1_error)
0948:
+0949: cdef inline void_int _at_ts(self, TimestampNanos ts) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__at_ts(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._at_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0950: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0951: if not line_sender_buffer_at_nanos(self._impl, ts._value, &err):
__pyx_t_1 = (!line_sender_buffer_at_nanos(__pyx_v_self->_impl, __pyx_v_ts->_value, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0952: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 952, __pyx_L1_error)
0953:
+0954: cdef inline void_int _at_dt(self, datetime dt) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__at_dt(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_v_value; struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Buffer._at_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0955: cdef int64_t value = datetime_to_nanos(dt)
__pyx_t_1 = __pyx_f_7questdb_7ingress_datetime_to_nanos(__pyx_v_dt); if (unlikely(__pyx_t_1 == ((int64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L1_error) __pyx_v_value = __pyx_t_1;
+0956: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0957: if not line_sender_buffer_at_nanos(self._impl, value, &err):
__pyx_t_2 = (!line_sender_buffer_at_nanos(__pyx_v_self->_impl, __pyx_v_value, (&__pyx_v_err))); if (unlikely(__pyx_t_2)) { /* … */ }
+0958: raise c_err_to_py(err)
__pyx_t_3 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 958, __pyx_L1_error)
0959:
+0960: cdef inline void_int _at_now(self) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__at_now(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._at_now", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0961: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0962: if not line_sender_buffer_at_now(self._impl, &err):
__pyx_t_1 = (!line_sender_buffer_at_now(__pyx_v_self->_impl, (&__pyx_v_err))); if (unlikely(__pyx_t_1)) { /* … */ }
+0963: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 963, __pyx_L1_error)
0964:
+0965: cdef inline void_int _at(self, object ts) except -1:
static CYTHON_INLINE __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__at(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_ts) { __pyx_t_7questdb_7ingress_void_int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.Buffer._at", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0966: if ts is None:
__pyx_t_1 = (__pyx_v_ts == Py_None); if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+0967: self._at_now()
__pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__at_now(__pyx_v_self); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 967, __pyx_L1_error)
+0968: elif isinstance(ts, TimestampNanos):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7questdb_7ingress_TimestampNanos);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+0969: self._at_ts(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7questdb_7ingress_TimestampNanos))))) __PYX_ERR(0, 969, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__at_ts(__pyx_v_self, ((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_ts)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 969, __pyx_L1_error)
+0970: elif isinstance(ts, datetime):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime);
if (likely(__pyx_t_1)) {
/* … */
goto __pyx_L3;
}
+0971: self._at_dt(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 971, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_6Buffer__at_dt(__pyx_v_self, ((PyDateTime_DateTime *)__pyx_v_ts)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 971, __pyx_L1_error)
0972: else:
+0973: raise TypeError(
/*else*/ { /* … */ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 973, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 973, __pyx_L1_error) } __pyx_L3:;
+0974: f'Unsupported type: {_fqn(type(ts))}. Must be one of: ' +
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_4 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Unsupported_type); __pyx_t_6 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_ts)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_4 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u_TimestampNanos_datetime_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0975: 'TimestampNanos, datetime, None')
0976:
+0977: cdef void_int _row(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Buffer__row(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, int __pyx_v_allow_auto_flush, PyObject *__pyx_v_table_name, struct __pyx_opt_args_7questdb_7ingress_6Buffer__row *__pyx_optional_args) { /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("questdb.ingress.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_name); __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ struct __pyx_opt_args_7questdb_7ingress_6Buffer__row { int __pyx_n; PyObject *symbols; PyObject *columns; PyObject *at; };
0978: self,
0979: bint allow_auto_flush,
0980: str table_name,
+0981: dict symbols=None,
PyObject *__pyx_v_symbols = ((PyObject*)Py_None);
+0982: dict columns=None,
PyObject *__pyx_v_columns = ((PyObject*)Py_None);
+0983: object at=None) except -1:
PyObject *__pyx_v_at = ((PyObject *)Py_None); int __pyx_v_wrote_fields; PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_value = NULL; __pyx_t_7questdb_7ingress_void_int __pyx_r; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_symbols = __pyx_optional_args->symbols; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_columns = __pyx_optional_args->columns; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_at = __pyx_optional_args->at; } } } }
0984: """
0985: Add a row to the buffer.
0986: """
+0987: cdef bint wrote_fields = False
__pyx_v_wrote_fields = 0;
+0988: self._set_marker()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__set_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 988, __pyx_L1_error)
+0989: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L1_error; __pyx_L8_try_end:; }
+0990: self._table(table_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__table(__pyx_v_self, __pyx_v_table_name); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 990, __pyx_L3_error)
+0991: if symbols is not None:
__pyx_t_5 = (__pyx_v_symbols != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+0992: for name, value in symbols.items():
__pyx_t_7 = 0; if (unlikely(__pyx_v_symbols == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 992, __pyx_L3_error) } __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_symbols, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 992, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_10; __pyx_t_10 = 0; while (1) { __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_8, &__pyx_t_7, &__pyx_t_10, &__pyx_t_11, NULL, __pyx_t_9); if (unlikely(__pyx_t_12 == 0)) break; if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 992, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); __pyx_t_11 = 0;
+0993: if value is not None:
__pyx_t_5 = (__pyx_v_value != Py_None);
if (__pyx_t_5) {
/* … */
}
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+0994: self._symbol(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 994, __pyx_L3_error) if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_value))) __PYX_ERR(0, 994, __pyx_L3_error) __pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__symbol(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 994, __pyx_L3_error)
+0995: wrote_fields = True
__pyx_v_wrote_fields = 1;
+0996: if columns is not None:
__pyx_t_5 = (__pyx_v_columns != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+0997: for name, value in columns.items():
__pyx_t_8 = 0; if (unlikely(__pyx_v_columns == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 997, __pyx_L3_error) } __pyx_t_11 = __Pyx_dict_iterator(__pyx_v_columns, 1, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 997, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_11; __pyx_t_11 = 0; while (1) { __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_7, &__pyx_t_8, &__pyx_t_11, &__pyx_t_10, NULL, __pyx_t_9); if (unlikely(__pyx_t_12 == 0)) break; if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 997, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); __pyx_t_10 = 0;
+0998: if value is not None:
__pyx_t_5 = (__pyx_v_value != Py_None);
if (__pyx_t_5) {
/* … */
}
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+0999: self._column(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 999, __pyx_L3_error) __pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__column(__pyx_v_self, ((PyObject*)__pyx_v_name), __pyx_v_value); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 999, __pyx_L3_error)
+1000: wrote_fields = True
__pyx_v_wrote_fields = 1;
+1001: if wrote_fields:
if (__pyx_v_wrote_fields) { /* … */ goto __pyx_L17; }
+1002: self._at(at if not isinstance(at, _ServerTimestamp) else None)
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_at, __pyx_ptype_7questdb_7ingress__ServerTimestamp); __pyx_t_13 = (!__pyx_t_5); if (__pyx_t_13) { __Pyx_INCREF(__pyx_v_at); __pyx_t_6 = __pyx_v_at; } else { __Pyx_INCREF(Py_None); __pyx_t_6 = Py_None; } __pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__at(__pyx_v_self, __pyx_t_6); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1002, __pyx_L3_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1003: self._clear_marker()
__pyx_t_6 = __pyx_f_7questdb_7ingress_6Buffer__clear_marker(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1003, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1004: else:
+1005: self._rewind_to_marker()
/*else*/ {
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1005, __pyx_L3_error)
}
__pyx_L17:;
+1006: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ingress.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 1006, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11);
+1007: self._rewind_to_marker()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1007, __pyx_L5_except_error)
+1008: raise
__Pyx_GIVEREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_10, __pyx_t_11); __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __PYX_ERR(0, 1008, __pyx_L5_except_error) }
+1009: if wrote_fields and allow_auto_flush:
if (__pyx_v_wrote_fields) { } else { __pyx_t_13 = __pyx_v_wrote_fields; goto __pyx_L21_bool_binop_done; } __pyx_t_13 = __pyx_v_allow_auto_flush; __pyx_L21_bool_binop_done:; if (__pyx_t_13) { /* … */ }
+1010: self._may_trigger_row_complete()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_1 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1010, __pyx_L1_error)
1011:
+1012: def row(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_15row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_14row, "\n Add a single row (line) to the buffer.\n\n .. code-block:: python\n\n # All fields specified.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def', 'sym3': None},\n columns={\n 'col1': True,\n 'col2': 123,\n 'col3': 3.14,\n 'col4': 'xyz',\n 'col5': TimestampMicros(123456789),\n 'col6': datetime(2019, 1, 1, 12, 0, 0),\n 'col7': None},\n at=TimestampNanos(123456789))\n\n # Only symbols specified. Designated timestamp assigned by the db.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def'}, at=Server.Timestamp)\n\n # Float columns and timestamp specified as `datetime.datetime`.\n # Pay special attention to the timezone, which if unspecified is\n # assumed to be the local timezone (and not UTC).\n buffer.row(\n 'sensor data',\n columns={\n 'temperature': 24.5,\n 'humidity': 0.5},\n at=datetime.datetime.now(tz=datetime.timezone.utc))\n\n\n Python strings passed as values to ``symbols`` are going to be encoded\n as the ``SYMBOL`` type in QuestDB, whilst Python strings passed as\n values to ``columns`` are going to be encoded as the ``STRING`` type.\n\n Refer to the\n `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to\n understand the difference between the ``SYMBOL`` and ``STRING`` types\n (TL;DR: symbols are interned strings).\n\n Column values can be specified with Python types directly and map as so:\n\n .. list-table::\n :header-rows: 1\n\n * - Python type\n - Serialized as ILP type\n * - ``bool``\n "" - `BOOLEAN <https://questdb.io/docs/reference/api/ilp/columnset-types#boolean>`_\n * - ``int``\n - `INTEGER <https://questdb.io/docs/reference/api/ilp/columnset-types#integer>`_\n * - ``float``\n - `FLOAT <https://questdb.io/docs/reference/api/ilp/columnset-types#float>`_\n * - ``str``\n - `STRING <https://questdb.io/docs/reference/api/ilp/columnset-types#string>`_\n * - ``datetime.datetime`` and ``TimestampMicros``\n - `TIMESTAMP <https://questdb.io/docs/reference/api/ilp/columnset-types#timestamp>`_\n * - ``None``\n - *Column is skipped and not serialized.*\n\n If the destination table was already created, then the columns types\n will be cast to the types of the existing columns whenever possible\n (Refer to the QuestDB documentation pages linked above).\n\n Adding a row can trigger auto-flushing behaviour.\n\n :param table_name: The name of the table to which the row belongs.\n :param symbols: A dictionary of symbol column names to ``str`` values.\n As a convenience, you can also pass a ``None`` value which will\n have the same effect as skipping the key: If the column already\n existed, it will be recorded as ``NULL``, otherwise it will not be\n created.\n :param columns: A dictionary of column names to ``bool``, ``int``,\n ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.\n As a convenience, you can also pass a ``None`` value which will\n have the same effect as skipping the key: If the column already\n existed, it will be recorded as ``NULL``, otherwise it will not be\n created.\n :param at: The timestamp of the row. This is required!\n If ``ServerTimestamp``, timestamp is assigned by QuestDB.\n If ``datetime``, the timestamp is converted to nano""seconds.\n A nanosecond unix epoch timestamp can be passed\n explicitly as a ``TimestampNanos`` object.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_15row = {"row", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_15row, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_14row}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_15row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,&__pyx_n_s_at,&__pyx_n_s_symbols,&__pyx_n_s_columns,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_14row(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__78 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_table_name, __pyx_n_s_symbols, __pyx_n_s_columns, __pyx_n_s_at); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__78); __Pyx_GIVEREF(__pyx_tuple__78); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_table_name, __pyx_n_s_str) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_symbols, __pyx_kp_s_Optional_Dict_str_Optional_str) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_columns, __pyx_kp_s_Optional_Dict_str_Union_None_boo) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_at, __pyx_kp_s_Union_ServerTimestamp_TimestampN) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_15row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_row, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_20, __pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_18); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer, __pyx_n_s_row, __pyx_t_20) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_row, 1012, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 1012, __pyx_L1_error)
1013: self,
1014: table_name: str,
1015: *,
+1016: symbols: Optional[Dict[str, Optional[str]]]=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_symbols, Py_None) < 0) __PYX_ERR(0, 1012, __pyx_L1_error)
1017: columns: Optional[Dict[
1018: str,
1019: Union[None, bool, int, float, str, TimestampMicros, datetime]]
+1020: ]=None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_name)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1012, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1012, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 1012, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 2)) { Py_ssize_t index; for (index = 2; index < 4 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1012, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "row") < 0)) __PYX_ERR(0, 1012, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 1012, __pyx_L3_error) } __pyx_v_table_name = ((PyObject*)values[0]); __pyx_v_at = values[1]; __pyx_v_symbols = ((PyObject*)values[2]); __pyx_v_columns = ((PyObject*)values[3]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1012, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 0, "table_name", 1))) __PYX_ERR(0, 1014, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_symbols), (&PyDict_Type), 1, "symbols", 1))) __PYX_ERR(0, 1016, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyDict_Type), 1, "columns", 1))) __PYX_ERR(0, 1017, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_14row(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_table_name, __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_columns, Py_None) < 0) __PYX_ERR(0, 1012, __pyx_L1_error)
1021: at: Union[ServerTimestamp, TimestampNanos, datetime]):
1022: """
1023: Add a single row (line) to the buffer.
1024:
1025: .. code-block:: python
1026:
1027: # All fields specified.
1028: buffer.row(
1029: 'table_name',
1030: symbols={'sym1': 'abc', 'sym2': 'def', 'sym3': None},
1031: columns={
1032: 'col1': True,
1033: 'col2': 123,
1034: 'col3': 3.14,
1035: 'col4': 'xyz',
1036: 'col5': TimestampMicros(123456789),
1037: 'col6': datetime(2019, 1, 1, 12, 0, 0),
1038: 'col7': None},
1039: at=TimestampNanos(123456789))
1040:
1041: # Only symbols specified. Designated timestamp assigned by the db.
1042: buffer.row(
1043: 'table_name',
1044: symbols={'sym1': 'abc', 'sym2': 'def'}, at=Server.Timestamp)
1045:
1046: # Float columns and timestamp specified as `datetime.datetime`.
1047: # Pay special attention to the timezone, which if unspecified is
1048: # assumed to be the local timezone (and not UTC).
1049: buffer.row(
1050: 'sensor data',
1051: columns={
1052: 'temperature': 24.5,
1053: 'humidity': 0.5},
1054: at=datetime.datetime.now(tz=datetime.timezone.utc))
1055:
1056:
1057: Python strings passed as values to ``symbols`` are going to be encoded
1058: as the ``SYMBOL`` type in QuestDB, whilst Python strings passed as
1059: values to ``columns`` are going to be encoded as the ``STRING`` type.
1060:
1061: Refer to the
1062: `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to
1063: understand the difference between the ``SYMBOL`` and ``STRING`` types
1064: (TL;DR: symbols are interned strings).
1065:
1066: Column values can be specified with Python types directly and map as so:
1067:
1068: .. list-table::
1069: :header-rows: 1
1070:
1071: * - Python type
1072: - Serialized as ILP type
1073: * - ``bool``
1074: - `BOOLEAN <https://questdb.io/docs/reference/api/ilp/columnset-types#boolean>`_
1075: * - ``int``
1076: - `INTEGER <https://questdb.io/docs/reference/api/ilp/columnset-types#integer>`_
1077: * - ``float``
1078: - `FLOAT <https://questdb.io/docs/reference/api/ilp/columnset-types#float>`_
1079: * - ``str``
1080: - `STRING <https://questdb.io/docs/reference/api/ilp/columnset-types#string>`_
1081: * - ``datetime.datetime`` and ``TimestampMicros``
1082: - `TIMESTAMP <https://questdb.io/docs/reference/api/ilp/columnset-types#timestamp>`_
1083: * - ``None``
1084: - *Column is skipped and not serialized.*
1085:
1086: If the destination table was already created, then the columns types
1087: will be cast to the types of the existing columns whenever possible
1088: (Refer to the QuestDB documentation pages linked above).
1089:
1090: Adding a row can trigger auto-flushing behaviour.
1091:
1092: :param table_name: The name of the table to which the row belongs.
1093: :param symbols: A dictionary of symbol column names to ``str`` values.
1094: As a convenience, you can also pass a ``None`` value which will
1095: have the same effect as skipping the key: If the column already
1096: existed, it will be recorded as ``NULL``, otherwise it will not be
1097: created.
1098: :param columns: A dictionary of column names to ``bool``, ``int``,
1099: ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.
1100: As a convenience, you can also pass a ``None`` value which will
1101: have the same effect as skipping the key: If the column already
1102: existed, it will be recorded as ``NULL``, otherwise it will not be
1103: created.
1104: :param at: The timestamp of the row. This is required!
1105: If ``ServerTimestamp``, timestamp is assigned by QuestDB.
1106: If ``datetime``, the timestamp is converted to nanoseconds.
1107: A nanosecond unix epoch timestamp can be passed
1108: explicitly as a ``TimestampNanos`` object.
1109: """
+1110: if at is None:
__pyx_t_1 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_1)) { /* … */ }
+1111: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+1112: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1111, __pyx_L1_error)
1113: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
1114: )
+1115: self._row(
__pyx_t_8.__pyx_n = 3;
__pyx_t_8.symbols = __pyx_v_symbols;
__pyx_t_8.columns = __pyx_v_columns;
__pyx_t_8.at = __pyx_v_at;
__pyx_t_7 = ((struct __pyx_vtabstruct_7questdb_7ingress_Buffer *)__pyx_v_self->__pyx_vtab)->_row(__pyx_v_self, 1, __pyx_v_table_name, &__pyx_t_8); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1115, __pyx_L1_error)
1116: True, # allow_auto_flush
1117: table_name,
1118: symbols,
1119: columns,
1120: at)
+1121: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
1122:
+1123: def dataframe(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_17dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Buffer_16dataframe, "\n Add a pandas DataFrame to the buffer.\n\n Also see the :func:`Sender.dataframe` method if you're\n not using the buffer explicitly. It supports the same parameters\n and also supports auto-flushing.\n\n This feature requires the ``pandas``, ``numpy`` and ``pyarrow``\n package to be installed.\n\n Adding a dataframe can trigger auto-flushing behaviour,\n even between rows of the same dataframe. To avoid this, you can\n use HTTP and transactions (see :func:`Sender.transaction`).\n\n :param df: The pandas DataFrame to serialize to the buffer.\n :type df: pandas.DataFrame\n\n :param table_name: The name of the table to which the rows belong.\n\n If ``None``, the table name is taken from the ``table_name_col``\n parameter. If both ``table_name`` and ``table_name_col`` are\n ``None``, the table name is taken from the DataFrame's index\n name (``df.index.name`` attribute).\n :type table_name: str or None\n\n :param table_name_col: The name or index of the column in the DataFrame\n that contains the table name.\n \n If ``None``, the table name is taken\n from the ``table_name`` parameter. If both ``table_name`` and\n ``table_name_col`` are ``None``, the table name is taken from the\n DataFrame's index name (``df.index.name`` attribute).\n\n If ``table_name_col`` is an integer, it is interpreted as the index\n of the column starting from ``0``. The index of the column can be\n negative, in which case it is interpreted as an offset from the end\n of the DataFrame. E.g. ``-1`` is the last column.\n :type table_name_col: str or int or None\n\n :param symbols: The columns to be serialized as symbols.\n \n If ``'auto'`` (default), all columns of dtype ``'categorical'`` are\n serialized a""s symbols. If ``True``, all ``str`` columns are\n serialized as symbols. If ``False``, no columns are serialized as\n symbols.\n \n The list of symbols can also be specified explicitly as a ``list``\n of column names (``str``) or indices (``int``). Integer indices\n start at ``0`` and can be negative, offset from the end of the\n DataFrame. E.g. ``-1`` is the last column.\n\n Only columns containing strings can be serialized as symbols.\n\n :type symbols: str or bool or list of str or list of int\n\n :param at: The designated timestamp of the rows.\n \n You can specify a single value for all rows or column name or index.\n If ``ServerTimestamp``, timestamp is assigned by the server for all rows.\n To pass in a timestamp explicitly as an integer use the\n ``TimestampNanos`` wrapper type. To get the current timestamp,\n use ``TimestampNanos.now()``.\n When passing a ``datetime.datetime`` object, the timestamp is\n converted to nanoseconds.\n A ``datetime`` object is assumed to be in the local timezone unless\n one is specified explicitly (so call\n ``datetime.datetime.now(tz=datetime.timezone.utc)`` instead\n of ``datetime.datetime.utcnow()`` for the current timestamp to\n avoid bugs).\n\n To specify a different timestamp for each row, pass in a column name\n (``str``) or index (``int``, 0-based index, negative index\n supported): In this case, the column needs to be of dtype\n ``datetime64[ns]`` (assumed to be in the **UTC timezone** and not\n local, due to differences in Pandas and Python datetime handling) or\n ``datetime64[ns, tz]``. When a timezone is specified in the column,\n it is converted to UTC automatically.\n\n A timestamp column ca""n also contain ``None`` values. The server will\n assign the current timestamp to those rows.\n\n **Note**: All timestamps are always converted to nanoseconds and in\n the UTC timezone. Timezone information is dropped before sending and\n QuestDB will not store any timezone information.\n :type at: TimestampNanos, datetime.datetime, int or str or None\n\n **Note**: It is an error to specify both ``table_name`` and\n ``table_name_col``.\n\n **Note**: The \"index\" column of the DataFrame is never serialized,\n even if it is named.\n\n Example:\n\n .. code-block:: python\n\n import pandas as pd\n import questdb.ingress as qi\n\n buf = qi.Buffer()\n # ...\n\n df = pd.DataFrame({\n 'location': ['London', 'Managua', 'London'],\n 'temperature': [24.5, 35.0, 25.5],\n 'humidity': [0.5, 0.6, 0.45],\n 'ts': pd.date_range('2021-07-01', periods=3)})\n buf.dataframe(\n df, table_name='weather', at='ts', symbols=['location'])\n\n # ...\n sender.flush(buf)\n\n **Pandas to ILP datatype mappings**\n\n .. seealso:: https://questdb.io/docs/reference/api/ilp/columnset-types/\n\n .. list-table:: Pandas Mappings\n :header-rows: 1\n\n * - Pandas ``dtype``\n - Nulls\n - ILP Datatype\n * - ``'bool'``\n - N\n - ``BOOLEAN``\n * - ``'boolean'``\n - N **\316\261**\n - ``BOOLEAN``\n * - ``'object'`` (``bool`` objects)\n - N **\316\261**\n - ``BOOLEAN``\n * - ``'uint8'``\n - N\n - ``INTEGER``\n * - ``'int8'``\n - N\n - ``INTEGER``\n * - ``'uint16'``\n - N\n - ""``INTEGER``\n * - ``'int16'``\n - N\n - ``INTEGER``\n * - ``'uint32'``\n - N\n - ``INTEGER``\n * - ``'int32'``\n - N\n - ``INTEGER``\n * - ``'uint64'``\n - N\n - ``INTEGER`` **\316\262**\n * - ``'int64'``\n - N\n - ``INTEGER``\n * - ``'UInt8'``\n - Y\n - ``INTEGER``\n * - ``'Int8'``\n - Y\n - ``INTEGER``\n * - ``'UInt16'``\n - Y\n - ``INTEGER``\n * - ``'Int16'``\n - Y\n - ``INTEGER``\n * - ``'UInt32'``\n - Y\n - ``INTEGER``\n * - ``'Int32'``\n - Y\n - ``INTEGER``\n * - ``'UInt64'``\n - Y\n - ``INTEGER`` **\316\262**\n * - ``'Int64'``\n - Y\n - ``INTEGER``\n * - ``'object'`` (``int`` objects)\n - Y\n - ``INTEGER`` **\316\262**\n * - ``'float32'`` **\316\263**\n - Y (``NaN``)\n - ``FLOAT``\n * - ``'float64'``\n - Y (``NaN``)\n - ``FLOAT``\n * - ``'object'`` (``float`` objects)\n - Y (``NaN``)\n - ``FLOAT``\n * - ``'string'`` (``str`` objects)\n - Y\n - ``STRING`` (default), ``SYMBOL`` via ``symbols`` arg. **\316\264**\n * - ``'string[pyarrow]'``\n - Y\n - ``STRING`` (default), ``SYMBOL`` via ``symbols`` arg. **\316\264**\n * - ``'category'`` (``str`` objects) **\316\265**\n - Y\n - ``SYMBOL`` (default), ``STRING`` via ``symbols`` arg. **\316\264**\n * - ``'object'`` (``str`` objects)\n - Y\n - ``STRING`` (""default), ``SYMBOL`` via ``symbols`` arg. **\316\264**\n * - ``'datetime64[ns]'``\n - Y\n - ``TIMESTAMP`` **\316\266**\n * - ``'datetime64[ns, tz]'``\n - Y\n - ``TIMESTAMP`` **\316\266**\n\n .. note::\n\n * **\316\261**: Note some pandas dtypes allow nulls (e.g. ``'boolean'``),\n where the QuestDB database does not.\n\n * **\316\262**: The valid range for integer values is -2^63 to 2^63-1.\n Any ``'uint64'``, ``'UInt64'`` or python ``int`` object values\n outside this range will raise an error during serialization.\n\n * **\316\263**: Upcast to 64-bit float during serialization.\n\n * **\316\264**: Columns containing strings can also be used to specify the\n table name. See ``table_name_col``.\n\n * **\316\265**: We only support categories containing strings. If the\n category contains non-string values, an error will be raised.\n\n * **\316\266**: The '.dataframe()' method only supports datetimes with\n nanosecond precision. The designated timestamp column (see ``at``\n parameter) maintains the nanosecond precision, whilst values\n stored as columns have their precision truncated to microseconds.\n All dates are sent as UTC and any additional timezone information\n is dropped. If no timezone is specified, we follow\n the pandas convention of assuming the timezone is UTC.\n Datetimes before 1970-01-01 00:00:00 UTC are not supported.\n If a datetime value is specified as ``None`` (``NaT``), it is\n interpreted as the current QuestDB server time set on receipt of\n message.\n\n **Error Handling and Recovery**\n\n In case an exception is raised during dataframe serialization, the\n buffer is left in its previous ""state.\n The buffer remains in a valid state and can be used for further calls\n even after an error.\n\n For clarification, as an example, if an invalid ``None``\n value appears at the 3rd row for a ``bool`` column, neither the 3rd nor\n the preceding rows are added to the buffer.\n\n **Note**: This differs from the :func:`Sender.dataframe` method, which\n modifies this guarantee due to its ``auto_flush`` logic.\n\n **Performance Considerations**\n\n The Python GIL is released during serialization if it is not needed.\n If any column requires the GIL, the entire serialization is done whilst\n holding the GIL.\n\n Column types that require the GIL are:\n\n * Columns of ``str``, ``float`` or ``int`` or ``float`` Python objects.\n * The ``'string[python]'`` dtype.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_17dataframe = {"dataframe", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_17dataframe, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_16dataframe}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_17dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_table_name_col = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dataframe (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_at,&__pyx_n_s_table_name,&__pyx_n_s_table_name_col,&__pyx_n_s_symbols,0}; PyObject* values[5] = {0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_16dataframe(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_table_name, PyObject *__pyx_v_table_name_col, PyObject *__pyx_v_symbols, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.Buffer.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__80 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_df, __pyx_n_s_table_name, __pyx_n_s_table_name_col, __pyx_n_s_symbols, __pyx_n_s_at); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__80); __Pyx_GIVEREF(__pyx_tuple__80); /* … */ __pyx_t_20 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_table_name, __pyx_kp_s_Optional_str) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_table_name_col, __pyx_kp_s_Union_None_int_str) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_symbols, __pyx_kp_s_Union_str_bool_List_int_List_str) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_at, __pyx_kp_s_Union_ServerTimestamp_int_str_Ti) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_17dataframe, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_dataframe, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_19, __pyx_t_20); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_18); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer, __pyx_n_s_dataframe, __pyx_t_19) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_dataframe, 1123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 1123, __pyx_L1_error)
1124: self,
1125: df, # : pd.DataFrame
1126: *,
+1127: table_name: Optional[str] = None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_table_name, Py_None) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)
+1128: table_name_col: Union[None, int, str] = None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_auto)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 1123, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 3)) { Py_ssize_t index; for (index = 2; index < 5 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dataframe") < 0)) __PYX_ERR(0, 1123, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 1123, __pyx_L3_error) } __pyx_v_df = values[0]; __pyx_v_at = values[1]; __pyx_v_table_name = ((PyObject*)values[2]); __pyx_v_table_name_col = values[3]; __pyx_v_symbols = values[4]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("dataframe", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1123, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Buffer.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 1127, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_16dataframe(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_df, __pyx_v_table_name, __pyx_v_table_name_col, __pyx_v_symbols, __pyx_v_at); /* … */ if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_table_name_col, Py_None) < 0) __PYX_ERR(0, 1123, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_symbols, __pyx_n_u_auto) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)
1129: symbols: Union[str, bool, List[int], List[str]] = 'auto',
1130: at: Union[ServerTimestamp, int, str, TimestampNanos, datetime]):
1131: """
1132: Add a pandas DataFrame to the buffer.
1133:
1134: Also see the :func:`Sender.dataframe` method if you're
1135: not using the buffer explicitly. It supports the same parameters
1136: and also supports auto-flushing.
1137:
1138: This feature requires the ``pandas``, ``numpy`` and ``pyarrow``
1139: package to be installed.
1140:
1141: Adding a dataframe can trigger auto-flushing behaviour,
1142: even between rows of the same dataframe. To avoid this, you can
1143: use HTTP and transactions (see :func:`Sender.transaction`).
1144:
1145: :param df: The pandas DataFrame to serialize to the buffer.
1146: :type df: pandas.DataFrame
1147:
1148: :param table_name: The name of the table to which the rows belong.
1149:
1150: If ``None``, the table name is taken from the ``table_name_col``
1151: parameter. If both ``table_name`` and ``table_name_col`` are
1152: ``None``, the table name is taken from the DataFrame's index
1153: name (``df.index.name`` attribute).
1154: :type table_name: str or None
1155:
1156: :param table_name_col: The name or index of the column in the DataFrame
1157: that contains the table name.
1158:
1159: If ``None``, the table name is taken
1160: from the ``table_name`` parameter. If both ``table_name`` and
1161: ``table_name_col`` are ``None``, the table name is taken from the
1162: DataFrame's index name (``df.index.name`` attribute).
1163:
1164: If ``table_name_col`` is an integer, it is interpreted as the index
1165: of the column starting from ``0``. The index of the column can be
1166: negative, in which case it is interpreted as an offset from the end
1167: of the DataFrame. E.g. ``-1`` is the last column.
1168: :type table_name_col: str or int or None
1169:
1170: :param symbols: The columns to be serialized as symbols.
1171:
1172: If ``'auto'`` (default), all columns of dtype ``'categorical'`` are
1173: serialized as symbols. If ``True``, all ``str`` columns are
1174: serialized as symbols. If ``False``, no columns are serialized as
1175: symbols.
1176:
1177: The list of symbols can also be specified explicitly as a ``list``
1178: of column names (``str``) or indices (``int``). Integer indices
1179: start at ``0`` and can be negative, offset from the end of the
1180: DataFrame. E.g. ``-1`` is the last column.
1181:
1182: Only columns containing strings can be serialized as symbols.
1183:
1184: :type symbols: str or bool or list of str or list of int
1185:
1186: :param at: The designated timestamp of the rows.
1187:
1188: You can specify a single value for all rows or column name or index.
1189: If ``ServerTimestamp``, timestamp is assigned by the server for all rows.
1190: To pass in a timestamp explicitly as an integer use the
1191: ``TimestampNanos`` wrapper type. To get the current timestamp,
1192: use ``TimestampNanos.now()``.
1193: When passing a ``datetime.datetime`` object, the timestamp is
1194: converted to nanoseconds.
1195: A ``datetime`` object is assumed to be in the local timezone unless
1196: one is specified explicitly (so call
1197: ``datetime.datetime.now(tz=datetime.timezone.utc)`` instead
1198: of ``datetime.datetime.utcnow()`` for the current timestamp to
1199: avoid bugs).
1200:
1201: To specify a different timestamp for each row, pass in a column name
1202: (``str``) or index (``int``, 0-based index, negative index
1203: supported): In this case, the column needs to be of dtype
1204: ``datetime64[ns]`` (assumed to be in the **UTC timezone** and not
1205: local, due to differences in Pandas and Python datetime handling) or
1206: ``datetime64[ns, tz]``. When a timezone is specified in the column,
1207: it is converted to UTC automatically.
1208:
1209: A timestamp column can also contain ``None`` values. The server will
1210: assign the current timestamp to those rows.
1211:
1212: **Note**: All timestamps are always converted to nanoseconds and in
1213: the UTC timezone. Timezone information is dropped before sending and
1214: QuestDB will not store any timezone information.
1215: :type at: TimestampNanos, datetime.datetime, int or str or None
1216:
1217: **Note**: It is an error to specify both ``table_name`` and
1218: ``table_name_col``.
1219:
1220: **Note**: The "index" column of the DataFrame is never serialized,
1221: even if it is named.
1222:
1223: Example:
1224:
1225: .. code-block:: python
1226:
1227: import pandas as pd
1228: import questdb.ingress as qi
1229:
1230: buf = qi.Buffer()
1231: # ...
1232:
1233: df = pd.DataFrame({
1234: 'location': ['London', 'Managua', 'London'],
1235: 'temperature': [24.5, 35.0, 25.5],
1236: 'humidity': [0.5, 0.6, 0.45],
1237: 'ts': pd.date_range('2021-07-01', periods=3)})
1238: buf.dataframe(
1239: df, table_name='weather', at='ts', symbols=['location'])
1240:
1241: # ...
1242: sender.flush(buf)
1243:
1244: **Pandas to ILP datatype mappings**
1245:
1246: .. seealso:: https://questdb.io/docs/reference/api/ilp/columnset-types/
1247:
1248: .. list-table:: Pandas Mappings
1249: :header-rows: 1
1250:
1251: * - Pandas ``dtype``
1252: - Nulls
1253: - ILP Datatype
1254: * - ``'bool'``
1255: - N
1256: - ``BOOLEAN``
1257: * - ``'boolean'``
1258: - N **α**
1259: - ``BOOLEAN``
1260: * - ``'object'`` (``bool`` objects)
1261: - N **α**
1262: - ``BOOLEAN``
1263: * - ``'uint8'``
1264: - N
1265: - ``INTEGER``
1266: * - ``'int8'``
1267: - N
1268: - ``INTEGER``
1269: * - ``'uint16'``
1270: - N
1271: - ``INTEGER``
1272: * - ``'int16'``
1273: - N
1274: - ``INTEGER``
1275: * - ``'uint32'``
1276: - N
1277: - ``INTEGER``
1278: * - ``'int32'``
1279: - N
1280: - ``INTEGER``
1281: * - ``'uint64'``
1282: - N
1283: - ``INTEGER`` **β**
1284: * - ``'int64'``
1285: - N
1286: - ``INTEGER``
1287: * - ``'UInt8'``
1288: - Y
1289: - ``INTEGER``
1290: * - ``'Int8'``
1291: - Y
1292: - ``INTEGER``
1293: * - ``'UInt16'``
1294: - Y
1295: - ``INTEGER``
1296: * - ``'Int16'``
1297: - Y
1298: - ``INTEGER``
1299: * - ``'UInt32'``
1300: - Y
1301: - ``INTEGER``
1302: * - ``'Int32'``
1303: - Y
1304: - ``INTEGER``
1305: * - ``'UInt64'``
1306: - Y
1307: - ``INTEGER`` **β**
1308: * - ``'Int64'``
1309: - Y
1310: - ``INTEGER``
1311: * - ``'object'`` (``int`` objects)
1312: - Y
1313: - ``INTEGER`` **β**
1314: * - ``'float32'`` **γ**
1315: - Y (``NaN``)
1316: - ``FLOAT``
1317: * - ``'float64'``
1318: - Y (``NaN``)
1319: - ``FLOAT``
1320: * - ``'object'`` (``float`` objects)
1321: - Y (``NaN``)
1322: - ``FLOAT``
1323: * - ``'string'`` (``str`` objects)
1324: - Y
1325: - ``STRING`` (default), ``SYMBOL`` via ``symbols`` arg. **δ**
1326: * - ``'string[pyarrow]'``
1327: - Y
1328: - ``STRING`` (default), ``SYMBOL`` via ``symbols`` arg. **δ**
1329: * - ``'category'`` (``str`` objects) **ε**
1330: - Y
1331: - ``SYMBOL`` (default), ``STRING`` via ``symbols`` arg. **δ**
1332: * - ``'object'`` (``str`` objects)
1333: - Y
1334: - ``STRING`` (default), ``SYMBOL`` via ``symbols`` arg. **δ**
1335: * - ``'datetime64[ns]'``
1336: - Y
1337: - ``TIMESTAMP`` **ζ**
1338: * - ``'datetime64[ns, tz]'``
1339: - Y
1340: - ``TIMESTAMP`` **ζ**
1341:
1342: .. note::
1343:
1344: * **α**: Note some pandas dtypes allow nulls (e.g. ``'boolean'``),
1345: where the QuestDB database does not.
1346:
1347: * **β**: The valid range for integer values is -2^63 to 2^63-1.
1348: Any ``'uint64'``, ``'UInt64'`` or python ``int`` object values
1349: outside this range will raise an error during serialization.
1350:
1351: * **γ**: Upcast to 64-bit float during serialization.
1352:
1353: * **δ**: Columns containing strings can also be used to specify the
1354: table name. See ``table_name_col``.
1355:
1356: * **ε**: We only support categories containing strings. If the
1357: category contains non-string values, an error will be raised.
1358:
1359: * **ζ**: The '.dataframe()' method only supports datetimes with
1360: nanosecond precision. The designated timestamp column (see ``at``
1361: parameter) maintains the nanosecond precision, whilst values
1362: stored as columns have their precision truncated to microseconds.
1363: All dates are sent as UTC and any additional timezone information
1364: is dropped. If no timezone is specified, we follow
1365: the pandas convention of assuming the timezone is UTC.
1366: Datetimes before 1970-01-01 00:00:00 UTC are not supported.
1367: If a datetime value is specified as ``None`` (``NaT``), it is
1368: interpreted as the current QuestDB server time set on receipt of
1369: message.
1370:
1371: **Error Handling and Recovery**
1372:
1373: In case an exception is raised during dataframe serialization, the
1374: buffer is left in its previous state.
1375: The buffer remains in a valid state and can be used for further calls
1376: even after an error.
1377:
1378: For clarification, as an example, if an invalid ``None``
1379: value appears at the 3rd row for a ``bool`` column, neither the 3rd nor
1380: the preceding rows are added to the buffer.
1381:
1382: **Note**: This differs from the :func:`Sender.dataframe` method, which
1383: modifies this guarantee due to its ``auto_flush`` logic.
1384:
1385: **Performance Considerations**
1386:
1387: The Python GIL is released during serialization if it is not needed.
1388: If any column requires the GIL, the entire serialization is done whilst
1389: holding the GIL.
1390:
1391: Column types that require the GIL are:
1392:
1393: * Columns of ``str``, ``float`` or ``int`` or ``float`` Python objects.
1394: * The ``'string[python]'`` dtype.
1395: """
+1396: if at is None:
__pyx_t_1 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_1)) { /* … */ }
+1397: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+1398: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1397, __pyx_L1_error)
1399: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
1400: )
+1401: _dataframe(
__pyx_t_7 = __pyx_f_7questdb_7ingress__dataframe(__pyx_f_7questdb_7ingress_auto_flush_blank(), __pyx_v_self->_impl, __pyx_v_self->_b, __pyx_v_df, __pyx_v_table_name, __pyx_v_table_name_col, __pyx_v_symbols, __pyx_v_at); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1401, __pyx_L1_error)
1402: auto_flush_blank(),
1403: self._impl,
1404: self._b,
1405: df,
1406: table_name,
1407: table_name_col,
1408: symbols,
1409: at)
+1410: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
1411:
1412:
1413: _FLUSH_FMT = ('{} - See https://py-questdb-client.readthedocs.io/en/'
+1414: 'v' + VERSION +
__Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_VERSION); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = PyNumber_Add(__pyx_kp_u_See_https_py_questdb_client_rea, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_19 = PyNumber_Add(__pyx_t_18, __pyx_kp_u_troubleshooting_html_inspecting); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLUSH_FMT, __pyx_t_19) < 0) __PYX_ERR(0, 1413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
1415: '/troubleshooting.html#inspecting-and-debugging-errors#flush-failed')
1416:
1417:
+1418: cdef uint64_t _timedelta_to_millis(object timedelta):
static uint64_t __pyx_f_7questdb_7ingress__timedelta_to_millis(PyObject *__pyx_v_timedelta) { int64_t __pyx_v_millis; uint64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress._timedelta_to_millis", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
1419: """
1420: Convert a timedelta to milliseconds.
1421: """
1422: cdef int64_t millis = (
+1423: (timedelta.microseconds // 1000) +
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_timedelta, __pyx_n_s_microseconds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_1, __pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_t_3); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_millis = __pyx_t_6;
+1424: (int(timedelta.total_seconds()) * 1000))
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_timedelta, __pyx_n_s_total_seconds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_MultiplyObjC(__pyx_t_3, __pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1425: if millis < 0:
__pyx_t_7 = (__pyx_v_millis < 0); if (unlikely(__pyx_t_7)) { /* … */ }
+1426: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1426, __pyx_L1_error)
+1427: f'Negative timedelta not allowed: {timedelta!r}.')
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = 0; __pyx_t_9 = 127; __Pyx_INCREF(__pyx_kp_u_Negative_timedelta_not_allowed); __pyx_t_8 += 32; __Pyx_GIVEREF(__pyx_kp_u_Negative_timedelta_not_allowed); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Negative_timedelta_not_allowed); __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_timedelta), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_9; __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u__5); __pyx_t_8 += 1; __Pyx_GIVEREF(__pyx_kp_u__5); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__5); __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1428: return millis
__pyx_r = __pyx_v_millis; goto __pyx_L0;
1429:
1430:
+1431: cdef int64_t auto_flush_rows_default(line_sender_protocol protocol):
static int64_t __pyx_f_7questdb_7ingress_auto_flush_rows_default(enum line_sender_protocol __pyx_v_protocol) {
int64_t __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("questdb.ingress.auto_flush_rows_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
+1432: if _is_http_protocol(protocol):
__pyx_t_1 = __pyx_f_7questdb_7ingress__is_http_protocol(__pyx_v_protocol); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1432, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+1433: return 75000
__pyx_r = 0x124F8; goto __pyx_L0;
1434: else:
+1435: return 600
/*else*/ { __pyx_r = 0x258; goto __pyx_L0; }
1436:
1437:
+1438: cdef void_int _parse_auto_flush(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress__parse_auto_flush(enum line_sender_protocol __pyx_v_protocol, PyObject *__pyx_v_auto_flush, PyObject *__pyx_v_auto_flush_rows, PyObject *__pyx_v_auto_flush_bytes, PyObject *__pyx_v_auto_flush_interval, struct __pyx_t_7questdb_7ingress_auto_flush_mode_t *__pyx_v_c_auto_flush) { __pyx_t_7questdb_7ingress_void_int __pyx_r; __Pyx_INCREF(__pyx_v_auto_flush); __Pyx_INCREF(__pyx_v_auto_flush_rows); __Pyx_INCREF(__pyx_v_auto_flush_bytes); __Pyx_INCREF(__pyx_v_auto_flush_interval); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress._parse_auto_flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_auto_flush); __Pyx_XDECREF(__pyx_v_auto_flush_rows); __Pyx_XDECREF(__pyx_v_auto_flush_bytes); __Pyx_XDECREF(__pyx_v_auto_flush_interval); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1439: line_sender_protocol protocol,
1440: object auto_flush,
1441: object auto_flush_rows,
1442: object auto_flush_bytes,
1443: object auto_flush_interval,
1444: auto_flush_mode_t* c_auto_flush
1445: ) except -1:
1446: # Set defaults.
+1447: if auto_flush_rows is None:
__pyx_t_1 = (__pyx_v_auto_flush_rows == Py_None); if (__pyx_t_1) { /* … */ }
+1448: auto_flush_rows = auto_flush_rows_default(protocol)
__pyx_t_2 = __pyx_f_7questdb_7ingress_auto_flush_rows_default(__pyx_v_protocol); if (unlikely(__pyx_t_2 == ((int64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_auto_flush_rows, __pyx_t_3); __pyx_t_3 = 0;
1449:
+1450: if auto_flush_bytes is None:
__pyx_t_1 = (__pyx_v_auto_flush_bytes == Py_None); if (__pyx_t_1) { /* … */ }
+1451: auto_flush_bytes = False
__Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_auto_flush_bytes, Py_False);
1452:
+1453: if auto_flush_interval is None:
__pyx_t_1 = (__pyx_v_auto_flush_interval == Py_None); if (__pyx_t_1) { /* … */ }
+1454: auto_flush_interval = 1000
__Pyx_INCREF(__pyx_int_1000); __Pyx_DECREF_SET(__pyx_v_auto_flush_interval, __pyx_int_1000);
1455:
+1456: if isinstance(auto_flush, str):
__pyx_t_1 = PyUnicode_Check(__pyx_v_auto_flush);
if (__pyx_t_1) {
/* … */
}
+1457: if auto_flush == 'off':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush, __pyx_n_u_off, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1457, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L7; }
+1458: auto_flush = False
__Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_auto_flush, Py_False);
+1459: elif auto_flush == 'on':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush, __pyx_n_u_on, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1459, __pyx_L1_error) if (likely(__pyx_t_1)) { /* … */ goto __pyx_L7; }
+1460: auto_flush = True
__Pyx_INCREF(Py_True); __Pyx_DECREF_SET(__pyx_v_auto_flush, Py_True);
1461: else:
+1462: raise IngressError(
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+1463: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1464: '"auto_flush" must be None, bool, "on" or "off", ' +
__pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_must_be_None_bool_on, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_t_5}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1462, __pyx_L1_error) } __pyx_L7:;
+1465: f'not {auto_flush!r}')
__pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_auto_flush), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1466:
1467: # Normalise auto_flush parameters to ints or False.
+1468: if isinstance(auto_flush_rows, str):
__pyx_t_1 = PyUnicode_Check(__pyx_v_auto_flush_rows);
if (__pyx_t_1) {
/* … */
goto __pyx_L8;
}
+1469: if auto_flush_rows == 'on':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_rows, __pyx_n_u_on, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1469, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+1470: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+1471: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_kp_u_auto_flush_rows_cannot_be_on}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1470, __pyx_L1_error)
1472: '"auto_flush_rows" cannot be "on"')
+1473: elif auto_flush_rows == 'off':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_rows, __pyx_n_u_off, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1473, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L9; }
+1474: auto_flush_rows = False
__Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_auto_flush_rows, Py_False);
1475: else:
+1476: auto_flush_rows = int(auto_flush_rows)
/*else*/ { __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_auto_flush_rows); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_auto_flush_rows, __pyx_t_3); __pyx_t_3 = 0; } __pyx_L9:;
+1477: elif auto_flush_rows is False or isinstance(auto_flush_rows, int):
__pyx_t_9 = (__pyx_v_auto_flush_rows == Py_False);
if (!__pyx_t_9) {
} else {
__pyx_t_1 = __pyx_t_9;
goto __pyx_L10_bool_binop_done;
}
__pyx_t_9 = PyInt_Check(__pyx_v_auto_flush_rows);
__pyx_t_1 = __pyx_t_9;
__pyx_L10_bool_binop_done:;
if (likely(__pyx_t_1)) {
goto __pyx_L8;
}
1478: pass
1479: else:
+1480: raise TypeError(
/*else*/ { /* … */ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1480, __pyx_L1_error) } __pyx_L8:;
+1481: '"auto_flush_rows" must be an int, False or "off", ' +
__pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_rows_must_be_an_int, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+1482: f'not {auto_flush_rows!r}')
__pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_auto_flush_rows), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1483:
+1484: if isinstance(auto_flush_bytes, str):
__pyx_t_1 = PyUnicode_Check(__pyx_v_auto_flush_bytes);
if (__pyx_t_1) {
/* … */
goto __pyx_L12;
}
+1485: if auto_flush_bytes == 'on':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_bytes, __pyx_n_u_on, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1485, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+1486: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+1487: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_kp_u_auto_flush_bytes_cannot_be_on}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1486, __pyx_L1_error)
1488: '"auto_flush_bytes" cannot be "on"')
+1489: elif auto_flush_bytes == 'off':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_bytes, __pyx_n_u_off, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1489, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L13; }
+1490: auto_flush_bytes = False
__Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_auto_flush_bytes, Py_False);
1491: else:
+1492: auto_flush_bytes = int(auto_flush_bytes)
/*else*/ { __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_auto_flush_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_auto_flush_bytes, __pyx_t_4); __pyx_t_4 = 0; } __pyx_L13:;
+1493: elif auto_flush_bytes is False or isinstance(auto_flush_bytes, int):
__pyx_t_9 = (__pyx_v_auto_flush_bytes == Py_False);
if (!__pyx_t_9) {
} else {
__pyx_t_1 = __pyx_t_9;
goto __pyx_L14_bool_binop_done;
}
__pyx_t_9 = PyInt_Check(__pyx_v_auto_flush_bytes);
__pyx_t_1 = __pyx_t_9;
__pyx_L14_bool_binop_done:;
if (likely(__pyx_t_1)) {
goto __pyx_L12;
}
1494: pass
1495: else:
+1496: raise TypeError(
/*else*/ { /* … */ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1496, __pyx_L1_error) } __pyx_L12:;
+1497: '"auto_flush_bytes" must be an int, False or "off", ' +
__pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_bytes_must_be_an_int, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1498: f'not {auto_flush_bytes!r}')
__pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_auto_flush_bytes), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1499:
+1500: if isinstance(auto_flush_interval, str):
__pyx_t_1 = PyUnicode_Check(__pyx_v_auto_flush_interval);
if (__pyx_t_1) {
/* … */
goto __pyx_L16;
}
+1501: if auto_flush_interval == 'on':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_interval, __pyx_n_u_on, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1501, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+1502: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+1503: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_kp_u_auto_flush_interval_cannot_be_o}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1502, __pyx_L1_error)
1504: '"auto_flush_interval" cannot be "on"')
+1505: elif auto_flush_interval == 'off':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_auto_flush_interval, __pyx_n_u_off, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1505, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L17; }
+1506: auto_flush_interval = False
__Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_auto_flush_interval, Py_False);
1507: else:
+1508: auto_flush_interval = int(auto_flush_interval)
/*else*/ { __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_auto_flush_interval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_auto_flush_interval, __pyx_t_3); __pyx_t_3 = 0; } __pyx_L17:;
+1509: elif auto_flush_interval is False or isinstance(auto_flush_interval, int):
__pyx_t_9 = (__pyx_v_auto_flush_interval == Py_False);
if (!__pyx_t_9) {
} else {
__pyx_t_1 = __pyx_t_9;
goto __pyx_L18_bool_binop_done;
}
__pyx_t_9 = PyInt_Check(__pyx_v_auto_flush_interval);
__pyx_t_1 = __pyx_t_9;
__pyx_L18_bool_binop_done:;
if (__pyx_t_1) {
goto __pyx_L16;
}
1510: pass
+1511: elif isinstance(auto_flush_interval, timedelta):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_auto_flush_interval, __pyx_ptype_7cpython_8datetime_timedelta);
if (likely(__pyx_t_1)) {
/* … */
goto __pyx_L16;
}
+1512: auto_flush_interval = _timedelta_to_millis(auto_flush_interval)
__pyx_t_10 = __pyx_f_7questdb_7ingress__timedelta_to_millis(__pyx_v_auto_flush_interval); if (unlikely(__pyx_t_10 == ((uint64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1512, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_auto_flush_interval, __pyx_t_3); __pyx_t_3 = 0;
1513: else:
+1514: raise TypeError(
/*else*/ { /* … */ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1514, __pyx_L1_error) } __pyx_L16:;
+1515: '"auto_flush_interval" must be an int, timedelta, False or "off", ' +
__pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_interval_must_be_an, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+1516: f'not {auto_flush_interval!r}')
__pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_auto_flush_interval), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1517:
1518: # Coerce auto_flush to bool if None.
+1519: if auto_flush is None:
__pyx_t_1 = (__pyx_v_auto_flush == Py_None); if (__pyx_t_1) { /* … */ goto __pyx_L20; }
1520: auto_flush = (
+1521: (auto_flush_rows is not False) or
__pyx_t_1 = (__pyx_v_auto_flush_rows != Py_False); if (!__pyx_t_1) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L21_bool_binop_done; }
+1522: (auto_flush_bytes is not False) or
__pyx_t_1 = (__pyx_v_auto_flush_bytes != Py_False); if (!__pyx_t_1) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L21_bool_binop_done; }
+1523: (auto_flush_interval is not False))
__pyx_t_1 = (__pyx_v_auto_flush_interval != Py_False); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __pyx_t_3 = 0; __pyx_L21_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_auto_flush, __pyx_t_4); __pyx_t_4 = 0;
+1524: elif not isinstance(auto_flush, bool):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_auto_flush, __pyx_ptype_7cpython_4bool_bool);
__pyx_t_9 = (!__pyx_t_1);
if (unlikely(__pyx_t_9)) {
/* … */
}
__pyx_L20:;
+1525: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1525, __pyx_L1_error)
+1526: '"auto_flush" must be None, bool, "on" or "off", ' +
__pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_must_be_None_bool_on, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1527: f'not {auto_flush!r}')
__pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_auto_flush), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1528:
1529: # Validate auto_flush parameters.
+1530: if auto_flush and \
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_auto_flush); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1530, __pyx_L1_error) if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L25_bool_binop_done; } /* … */ if (unlikely(__pyx_t_9)) { /* … */ }
+1531: (auto_flush_rows is False) and \
__pyx_t_1 = (__pyx_v_auto_flush_rows == Py_False); if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L25_bool_binop_done; }
+1532: (auto_flush_bytes is False) and \
__pyx_t_1 = (__pyx_v_auto_flush_bytes == Py_False); if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L25_bool_binop_done; }
+1533: (auto_flush_interval is False):
__pyx_t_1 = (__pyx_v_auto_flush_interval == Py_False); __pyx_t_9 = __pyx_t_1; __pyx_L25_bool_binop_done:;
+1534: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1534, __pyx_L1_error) /* … */ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_u_auto_flush_is_enabled_but_no_ot); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1534, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36);
1535: '"auto_flush" is enabled but no other auto-flush '
1536: 'parameters are enabled. Please set at least one of '
1537: '"auto_flush_rows", "auto_flush_bytes" or '
1538: '"auto_flush_interval".')
1539:
+1540: if auto_flush_rows is not False and auto_flush_rows < 1:
__pyx_t_1 = (__pyx_v_auto_flush_rows != Py_False); if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L30_bool_binop_done; } __pyx_t_3 = PyObject_RichCompare(__pyx_v_auto_flush_rows, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1540, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __pyx_t_1; __pyx_L30_bool_binop_done:; if (unlikely(__pyx_t_9)) { /* … */ }
+1541: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1541, __pyx_L1_error)
+1542: '"auto_flush_rows" must be >= 1, '
__pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_rows_must_be_1_not, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1543: f'not {auto_flush_rows}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_auto_flush_rows, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
1544:
+1545: if auto_flush_bytes is not False and auto_flush_bytes < 1:
__pyx_t_1 = (__pyx_v_auto_flush_bytes != Py_False); if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L33_bool_binop_done; } __pyx_t_3 = PyObject_RichCompare(__pyx_v_auto_flush_bytes, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1545, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __pyx_t_1; __pyx_L33_bool_binop_done:; if (unlikely(__pyx_t_9)) { /* … */ }
+1546: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1546, __pyx_L1_error)
+1547: '"auto_flush_bytes" must be >= 1, '
__pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_bytes_must_be_1_not, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1548: f'not {auto_flush_bytes}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_auto_flush_bytes, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
1549:
+1550: if auto_flush_interval is not False and auto_flush_interval < 1:
__pyx_t_1 = (__pyx_v_auto_flush_interval != Py_False); if (__pyx_t_1) { } else { __pyx_t_9 = __pyx_t_1; goto __pyx_L36_bool_binop_done; } __pyx_t_3 = PyObject_RichCompare(__pyx_v_auto_flush_interval, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1550, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1550, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __pyx_t_1; __pyx_L36_bool_binop_done:; if (unlikely(__pyx_t_9)) { /* … */ }
+1551: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1551, __pyx_L1_error)
+1552: '"auto_flush_interval" must be >= 1, '
__pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_interval_must_be_1_n, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1553: f'not {auto_flush_interval}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_auto_flush_interval, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
1554:
1555: # Parse individual auto_flush parameters to C struct.
+1556: c_auto_flush.enabled = auto_flush
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_auto_flush); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1556, __pyx_L1_error) __pyx_v_c_auto_flush->enabled = __pyx_t_9;
1557:
+1558: if auto_flush_rows is False:
__pyx_t_9 = (__pyx_v_auto_flush_rows == Py_False); if (__pyx_t_9) { /* … */ goto __pyx_L38; }
+1559: c_auto_flush.row_count = -1
__pyx_v_c_auto_flush->row_count = -1L;
1560: else:
+1561: c_auto_flush.row_count = auto_flush_rows
/*else*/ { __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_v_auto_flush_rows); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1561, __pyx_L1_error) __pyx_v_c_auto_flush->row_count = __pyx_t_2; } __pyx_L38:;
1562:
+1563: if auto_flush_bytes is False:
__pyx_t_9 = (__pyx_v_auto_flush_bytes == Py_False); if (__pyx_t_9) { /* … */ goto __pyx_L39; }
+1564: c_auto_flush.byte_count = -1
__pyx_v_c_auto_flush->byte_count = -1L;
1565: else:
+1566: c_auto_flush.byte_count = auto_flush_bytes
/*else*/ { __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_v_auto_flush_bytes); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L1_error) __pyx_v_c_auto_flush->byte_count = __pyx_t_2; } __pyx_L39:;
1567:
+1568: if auto_flush_interval is False:
__pyx_t_9 = (__pyx_v_auto_flush_interval == Py_False); if (__pyx_t_9) { /* … */ goto __pyx_L40; }
+1569: c_auto_flush.interval = -1
__pyx_v_c_auto_flush->interval = -1L;
1570: else:
+1571: c_auto_flush.interval = auto_flush_interval
/*else*/ { __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_v_auto_flush_interval); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1571, __pyx_L1_error) __pyx_v_c_auto_flush->interval = __pyx_t_2; } __pyx_L40:;
1572:
1573:
+1574: class TaggedEnum(Enum):
__Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_Enum); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_GIVEREF(__pyx_t_19); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19)) __PYX_ERR(0, 1574, __pyx_L1_error); __pyx_t_19 = 0; __pyx_t_19 = __Pyx_PEP560_update_bases(__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = __Pyx_CalculateMetaclass(NULL, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_15 = __Pyx_Py3MetaclassPrepare(__pyx_t_20, __pyx_t_19, __pyx_n_s_TaggedEnum, __pyx_n_s_TaggedEnum, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_Base_class_for_tagged_enums); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__pyx_t_19 != __pyx_t_18) { if (unlikely((PyDict_SetItemString(__pyx_t_15, "__orig_bases__", __pyx_t_18) < 0))) __PYX_ERR(0, 1574, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; /* … */ __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_20, __pyx_n_s_TaggedEnum, __pyx_t_19, __pyx_t_15, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_TaggedEnum, __pyx_t_3) < 0) __PYX_ERR(0, 1574, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
1575: """
1576: Base class for tagged enums.
1577: """
1578:
+1579: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_1tag(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_10TaggedEnum_tag, "\n Short name.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_10TaggedEnum_1tag = {"tag", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_10TaggedEnum_1tag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_10TaggedEnum_tag}; static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_1tag(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tag (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1579, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tag") < 0)) __PYX_ERR(0, 1579, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_self = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("tag", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1579, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TaggedEnum.tag", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_10TaggedEnum_tag(__pyx_self, __pyx_v_self); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_10TaggedEnum_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.TaggedEnum.tag", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_10TaggedEnum_1tag, 0, __pyx_n_s_TaggedEnum_tag, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetNameInClass(__pyx_t_15, __pyx_n_s_tag, __pyx_t_3) < 0) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_tag, 1579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1579, __pyx_L1_error)
1580: def tag(self):
1581: """
1582: Short name.
1583: """
+1584: return self.value[0]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
1585:
+1586: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_3c_value(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_10TaggedEnum_3c_value = {"c_value", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_10TaggedEnum_3c_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_3c_value(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_value (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "c_value") < 0)) __PYX_ERR(0, 1586, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_self = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("c_value", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1586, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TaggedEnum.c_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_10TaggedEnum_2c_value(__pyx_self, __pyx_v_self); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_10TaggedEnum_2c_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.TaggedEnum.c_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_10TaggedEnum_3c_value, 0, __pyx_n_s_TaggedEnum_c_value, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetNameInClass(__pyx_t_15, __pyx_n_s_c_value, __pyx_t_18) < 0) __PYX_ERR(0, 1586, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; /* … */ __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_c_value, 1586, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 1586, __pyx_L1_error)
1587: def c_value(self):
+1588: return self.value[1]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
1589:
+1590: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_5parse(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_10TaggedEnum_4parse, "\n Parse from the tag name.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_10TaggedEnum_5parse = {"parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_10TaggedEnum_5parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_10TaggedEnum_4parse}; static PyObject *__pyx_pw_7questdb_7ingress_10TaggedEnum_5parse(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_cls = 0; PyObject *__pyx_v_tag = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("parse (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_tag,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cls)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1590, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1590, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, 1); __PYX_ERR(0, 1590, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parse") < 0)) __PYX_ERR(0, 1590, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_cls = values[0]; __pyx_v_tag = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1590, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.TaggedEnum.parse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_10TaggedEnum_4parse(__pyx_self, __pyx_v_cls, __pyx_v_tag); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_10TaggedEnum_4parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_tag) { PyObject *__pyx_v_entry = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ingress.TaggedEnum.parse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_entry); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__86 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_tag, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__86); __Pyx_GIVEREF(__pyx_tuple__86); /* … */ __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_10TaggedEnum_5parse, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_TaggedEnum_parse, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__Pyx_SetNameInClass(__pyx_t_15, __pyx_n_s_parse, __pyx_t_3) < 0) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_parse, 1590, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 1590, __pyx_L1_error)
1591: def parse(cls, tag):
1592: """
1593: Parse from the tag name.
1594: """
+1595: if tag is None:
__pyx_t_1 = (__pyx_v_tag == Py_None); if (__pyx_t_1) { /* … */ }
+1596: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+1597: elif isinstance(tag, str):
__pyx_t_1 = PyUnicode_Check(__pyx_v_tag);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+1598: for entry in cls:
if (likely(PyList_CheckExact(__pyx_v_cls)) || PyTuple_CheckExact(__pyx_v_cls)) { __pyx_t_2 = __pyx_v_cls; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1598, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1598, __pyx_L1_error) #endif if (__pyx_t_3 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 1598, __pyx_L1_error) #else __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1598, __pyx_L1_error) #endif if (__pyx_t_3 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 1598, __pyx_L1_error) #else __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1598, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_5); __pyx_t_5 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1599: if entry.tag == tag:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_1) { /* … */ }
+1600: return entry
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_entry); __pyx_r = __pyx_v_entry; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
+1601: elif isinstance(tag, cls):
__pyx_t_1 = PyObject_IsInstance(__pyx_v_tag, __pyx_v_cls); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1601, __pyx_L1_error) if (likely(__pyx_t_1)) { /* … */ }
+1602: return tag
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_tag); __pyx_r = __pyx_v_tag; goto __pyx_L0;
1603: else:
+1604: raise ValueError(f'Invalid value for {cls.__name__}: {tag!r}')
/*else*/ { __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_Invalid_value_for); __pyx_t_3 += 18; __Pyx_GIVEREF(__pyx_kp_u_Invalid_value_for); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Invalid_value_for); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_7; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__21); __pyx_t_3 += 2; __Pyx_GIVEREF(__pyx_kp_u__21); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__21); __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_tag), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_7; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1604, __pyx_L1_error) } __pyx_L3:;
1605:
1606:
+1607: class Protocol(TaggedEnum):
__Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_TaggedEnum); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_GIVEREF(__pyx_t_19); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19)) __PYX_ERR(0, 1607, __pyx_L1_error); __pyx_t_19 = 0; __pyx_t_19 = __Pyx_PEP560_update_bases(__pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_19, __pyx_n_s_Protocol, __pyx_n_s_Protocol, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_Protocol_to_use_for_sending_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_19 != __pyx_t_20) { if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_t_20) < 0))) __PYX_ERR(0, 1607, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; /* … */ __pyx_t_18 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_Protocol, __pyx_t_19, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Protocol, __pyx_t_18) < 0) __PYX_ERR(0, 1607, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
1608: """
1609: Protocol to use for sending data to QuestDB.
1610:
1611: See :ref:`sender_which_protocol` for more information.
1612: """
+1613: Tcp = ('tcp', 0)
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_Tcp, __pyx_tuple__88) < 0) __PYX_ERR(0, 1613, __pyx_L1_error) /* … */ __pyx_tuple__88 = PyTuple_Pack(2, __pyx_n_u_tcp, __pyx_int_0); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 1613, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__88); __Pyx_GIVEREF(__pyx_tuple__88);
+1614: Tcps = ('tcps', 1)
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_Tcps, __pyx_tuple__89) < 0) __PYX_ERR(0, 1614, __pyx_L1_error) /* … */ __pyx_tuple__89 = PyTuple_Pack(2, __pyx_n_u_tcps, __pyx_int_1); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__89); __Pyx_GIVEREF(__pyx_tuple__89);
+1615: Http = ('http', 2)
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_Http, __pyx_tuple__90) < 0) __PYX_ERR(0, 1615, __pyx_L1_error) /* … */ __pyx_tuple__90 = PyTuple_Pack(2, __pyx_n_u_http, __pyx_int_2); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 1615, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__90); __Pyx_GIVEREF(__pyx_tuple__90);
+1616: Https = ('https', 3)
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_Https, __pyx_tuple__91) < 0) __PYX_ERR(0, 1616, __pyx_L1_error) /* … */ __pyx_tuple__91 = PyTuple_Pack(2, __pyx_n_u_https, __pyx_int_3); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1616, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__91); __Pyx_GIVEREF(__pyx_tuple__91);
1617:
+1618: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_8Protocol_1tls_enabled(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_8Protocol_1tls_enabled = {"tls_enabled", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_8Protocol_1tls_enabled, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_8Protocol_1tls_enabled(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_self = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tls_enabled (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tls_enabled") < 0)) __PYX_ERR(0, 1618, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_self = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("tls_enabled", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1618, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Protocol.tls_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_8Protocol_tls_enabled(__pyx_self, __pyx_v_self); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_8Protocol_tls_enabled(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Protocol.tls_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_8Protocol_1tls_enabled, 0, __pyx_n_s_Protocol_tls_enabled, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_20); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tls_enabled, __pyx_t_18) < 0) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; /* … */ __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_tls_enabled, 1618, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1618, __pyx_L1_error)
1619: def tls_enabled(self):
+1620: return self in (Protocol.Tcps, Protocol.Https)
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_t_1 = __pyx_v_self; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Tcps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_5) { } else { __pyx_t_2 = __pyx_t_5; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Https); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_5; __pyx_L3_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1621:
1622:
+1623: class TlsCa(TaggedEnum):
__Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_TaggedEnum); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_GIVEREF(__pyx_t_19); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_19)) __PYX_ERR(0, 1623, __pyx_L1_error); __pyx_t_19 = 0; __pyx_t_19 = __Pyx_PEP560_update_bases(__pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_18 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_19, __pyx_n_s_TlsCa, __pyx_n_s_TlsCa, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_Verification_mechanism_for_the); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_19 != __pyx_t_15) { if (unlikely((PyDict_SetItemString(__pyx_t_18, "__orig_bases__", __pyx_t_15) < 0))) __PYX_ERR(0, 1623, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; /* … */ __pyx_t_15 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_TlsCa, __pyx_t_19, __pyx_t_18, NULL, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (PyDict_SetItem(__pyx_d, __pyx_n_s_TlsCa, __pyx_t_15) < 0) __PYX_ERR(0, 1623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
1624: """
1625: Verification mechanism for the server's certificate.
1626:
1627: Here ``webpki`` refers to the
1628: `WebPKI library <https://github.com/rustls/webpki-roots>`_ and
1629: ``os`` refers to the operating system's certificate store.
1630:
1631: See :ref:`sender_conf_tls` for more information.
1632: """
+1633: WebpkiRoots = ('webpki_roots', line_sender_ca_webpki_roots)
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_ca(line_sender_ca_webpki_roots); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_INCREF(__pyx_n_u_webpki_roots); __Pyx_GIVEREF(__pyx_n_u_webpki_roots); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_n_u_webpki_roots)) __PYX_ERR(0, 1633, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_15); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_15)) __PYX_ERR(0, 1633, __pyx_L1_error); __pyx_t_15 = 0; if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_WebpkiRoots, __pyx_t_20) < 0) __PYX_ERR(0, 1633, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+1634: OsRoots = ('os_roots', line_sender_ca_os_roots)
__pyx_t_20 = __Pyx_PyInt_From_enum__line_sender_ca(line_sender_ca_os_roots); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_n_u_os_roots); __Pyx_GIVEREF(__pyx_n_u_os_roots); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_n_u_os_roots)) __PYX_ERR(0, 1634, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_20); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20)) __PYX_ERR(0, 1634, __pyx_L1_error); __pyx_t_20 = 0; if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_OsRoots, __pyx_t_15) < 0) __PYX_ERR(0, 1634, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+1635: WebpkiAndOsRoots = ('webpki_and_os_roots', line_sender_ca_webpki_and_os_roots)
__pyx_t_15 = __Pyx_PyInt_From_enum__line_sender_ca(line_sender_ca_webpki_and_os_roots); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_INCREF(__pyx_n_u_webpki_and_os_roots); __Pyx_GIVEREF(__pyx_n_u_webpki_and_os_roots); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_n_u_webpki_and_os_roots)) __PYX_ERR(0, 1635, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_15); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_15)) __PYX_ERR(0, 1635, __pyx_L1_error); __pyx_t_15 = 0; if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_WebpkiAndOsRoots, __pyx_t_20) < 0) __PYX_ERR(0, 1635, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+1636: PemFile = ('pem_file', line_sender_ca_pem_file)
__pyx_t_20 = __Pyx_PyInt_From_enum__line_sender_ca(line_sender_ca_pem_file); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_n_u_pem_file); __Pyx_GIVEREF(__pyx_n_u_pem_file); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_n_u_pem_file)) __PYX_ERR(0, 1636, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_20); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20)) __PYX_ERR(0, 1636, __pyx_L1_error); __pyx_t_20 = 0; if (__Pyx_SetNameInClass(__pyx_t_18, __pyx_n_s_PemFile, __pyx_t_15) < 0) __PYX_ERR(0, 1636, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
1637:
1638:
+1639: cdef object c_parse_conf_err_to_py(questdb_conf_str_parse_err* err):
static PyObject *__pyx_f_7questdb_7ingress_c_parse_conf_err_to_py(struct questdb_conf_str_parse_err *__pyx_v_err) { PyObject *__pyx_v_msg = 0; PyObject *__pyx_v_py_err = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.c_parse_conf_err_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_msg); __Pyx_XDECREF(__pyx_v_py_err); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1640: cdef str msg = PyUnicode_FromStringAndSize(
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_err->msg, ((Py_ssize_t)__pyx_v_err->msg_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_msg = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
1641: err.msg, <Py_ssize_t>err.msg_len)
+1642: cdef object py_err = IngressError(IngressErrorCode.ConfigError, msg)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_msg}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_py_err = __pyx_t_1; __pyx_t_1 = 0;
+1643: questdb_conf_str_parse_err_free(err)
questdb_conf_str_parse_err_free(__pyx_v_err);
+1644: return py_err
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_py_err); __pyx_r = __pyx_v_py_err; goto __pyx_L0;
1645:
1646:
+1647: cdef object parse_conf_str(
static PyObject *__pyx_f_7questdb_7ingress_parse_conf_str(struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_conf_str) { size_t __pyx_v_c_len1; char const *__pyx_v_c_buf1; size_t __pyx_v_c_len2; char const *__pyx_v_c_buf2; PyObject *__pyx_v_service = 0; struct questdb_conf_str_iter *__pyx_v_c_iter; PyObject *__pyx_v_key = 0; PyObject *__pyx_v_value = 0; PyObject *__pyx_v_params = 0; struct line_sender_utf8 __pyx_v_c_conf_str_utf8; struct questdb_conf_str_parse_err *__pyx_v_err; struct questdb_conf_str *__pyx_v_c_conf_str; PyObject *__pyx_v_type_mappings = NULL; PyObject *__pyx_8genexpr1__pyx_v_k = NULL; PyObject *__pyx_8genexpr1__pyx_v_v = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("questdb.ingress.parse_conf_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_service); __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_value); __Pyx_XDECREF(__pyx_v_params); __Pyx_XDECREF(__pyx_v_type_mappings); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1648: qdb_pystr_buf* b,
1649: str conf_str):
1650: """
1651: Parse a config string to a tuple of (Protocol, dict[str, str]).
1652: """
1653: cdef size_t c_len1
1654: cdef const char* c_buf1
1655: cdef size_t c_len2
1656: cdef const char* c_buf2
1657: cdef str service
1658: cdef questdb_conf_str_iter* c_iter
1659: cdef str key
1660: cdef str value
+1661: cdef dict params = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_params = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
1662: cdef line_sender_utf8 c_conf_str_utf8
1663: cdef questdb_conf_str_parse_err* err
1664: cdef questdb_conf_str* c_conf_str
+1665: str_to_utf8(b, <PyObject*>conf_str, &c_conf_str_utf8)
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_conf_str), (&__pyx_v_c_conf_str_utf8)); if (unlikely(__pyx_t_2 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1665, __pyx_L1_error)
+1666: c_conf_str = questdb_conf_str_parse(
__pyx_v_c_conf_str = questdb_conf_str_parse(__pyx_v_c_conf_str_utf8.buf, __pyx_v_c_conf_str_utf8.len, (&__pyx_v_err));
1667: c_conf_str_utf8.buf,
1668: c_conf_str_utf8.len,
1669: &err)
+1670: if c_conf_str == NULL:
__pyx_t_3 = (__pyx_v_c_conf_str == NULL); if (unlikely(__pyx_t_3)) { /* … */ }
+1671: raise c_parse_conf_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_parse_conf_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1671, __pyx_L1_error)
1672:
+1673: c_buf1 = questdb_conf_str_service(c_conf_str, &c_len1)
__pyx_v_c_buf1 = questdb_conf_str_service(__pyx_v_c_conf_str, (&__pyx_v_c_len1));
+1674: service = PyUnicode_FromStringAndSize(c_buf1, <Py_ssize_t>c_len1)
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_c_buf1, ((Py_ssize_t)__pyx_v_c_len1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_service = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
1675:
+1676: c_iter = questdb_conf_str_iter_pairs(c_conf_str)
__pyx_v_c_iter = questdb_conf_str_iter_pairs(__pyx_v_c_conf_str);
+1677: while questdb_conf_str_iter_next(c_iter, &c_buf1, &c_len1, &c_buf2, &c_len2):
while (1) { __pyx_t_3 = questdb_conf_str_iter_next(__pyx_v_c_iter, (&__pyx_v_c_buf1), (&__pyx_v_c_len1), (&__pyx_v_c_buf2), (&__pyx_v_c_len2)); if (!__pyx_t_3) break;
+1678: key = PyUnicode_FromStringAndSize(c_buf1, <Py_ssize_t>c_len1)
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_c_buf1, ((Py_ssize_t)__pyx_v_c_len1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+1679: value = PyUnicode_FromStringAndSize(c_buf2, <Py_ssize_t>c_len2)
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_c_buf2, ((Py_ssize_t)__pyx_v_c_len2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_value, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+1680: params[key] = value
if (unlikely((PyDict_SetItem(__pyx_v_params, __pyx_v_key, __pyx_v_value) < 0))) __PYX_ERR(0, 1680, __pyx_L1_error) }
1681:
+1682: questdb_conf_str_iter_free(c_iter)
questdb_conf_str_iter_free(__pyx_v_c_iter);
+1683: questdb_conf_str_free(c_conf_str)
questdb_conf_str_free(__pyx_v_c_conf_str);
1684:
1685: # We now need to parse the various values in the dict from their
1686: # string values to their Python types, as expected by the overrides
1687: # API of Sender.from_conf and Sender.from_env.
1688: # Note that some of these values, such as `tls_ca` or `auto_flush`
1689: # are kept as strings and are parsed by Sender._set_sender_fields.
1690: type_mappings = {
+1691: 'bind_interface': str,
__pyx_t_1 = __Pyx_PyDict_NewPresized(20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_bind_interface, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1692: 'username': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_username, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1693: 'password': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_password, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1694: 'token': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_token, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1695: 'token_x': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_token_x, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1696: 'token_y': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_token_y, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1697: 'auth_timeout': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auth_timeout, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1698: 'tls_verify': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tls_verify, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1699: 'tls_ca': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tls_ca, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1700: 'tls_roots': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tls_roots, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1701: 'max_buf_size': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_max_buf_size, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1702: 'retry_timeout': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_retry_timeout, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1703: 'request_min_throughput': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_request_min_throughput, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1704: 'request_timeout': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_request_timeout, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1705: 'auto_flush': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auto_flush, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1706: 'auto_flush_rows': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auto_flush_rows, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1707: 'auto_flush_bytes': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auto_flush_bytes, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1708: 'auto_flush_interval': str,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auto_flush_interval, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1709: 'init_buf_size': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_buf_size, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error)
+1710: 'max_name_len': int,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_max_name_len, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1691, __pyx_L1_error) __pyx_v_type_mappings = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
1711: }
+1712: params = {
{ /* enter inner scope */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_1);
+1713: k: type_mappings.get(k, str)(v)
__pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_type_mappings, __pyx_8genexpr1__pyx_v_k, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1713, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_11 = NULL; __pyx_t_12 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_12 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_8genexpr1__pyx_v_v}; __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1713, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_k, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1713, __pyx_L8_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0; goto __pyx_L11_exit_scope; __pyx_L8_error:; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0; goto __pyx_L1_error; __pyx_L11_exit_scope:; } /* exit inner scope */ __Pyx_DECREF_SET(__pyx_v_params, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+1714: for k, v in params.items()
__pyx_t_5 = 0; __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_params, 1, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1714, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_8; __pyx_t_8 = 0; while (1) { __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, &__pyx_t_9, NULL, __pyx_t_7); if (unlikely(__pyx_t_10 == 0)) break; if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 1714, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_9); __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_k, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_v, __pyx_t_9); __pyx_t_9 = 0;
1715: }
+1716: return (Protocol.parse(service), params)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_parse); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_12 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_12 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_service}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1)) __PYX_ERR(0, 1716, __pyx_L1_error); __Pyx_INCREF(__pyx_v_params); __Pyx_GIVEREF(__pyx_v_params); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_params)) __PYX_ERR(0, 1716, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_9; __pyx_t_9 = 0; goto __pyx_L0;
1717:
1718:
+1719: cdef class Sender:
struct __pyx_vtabstruct_7questdb_7ingress_Sender { __pyx_t_7questdb_7ingress_void_int (*_set_sender_fields)(struct __pyx_obj_7questdb_7ingress_Sender *, struct qdb_pystr_buf *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); PyObject *(*flush)(struct __pyx_obj_7questdb_7ingress_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_flush *__pyx_optional_args); PyObject *(*_close)(struct __pyx_obj_7questdb_7ingress_Sender *); PyObject *(*close)(struct __pyx_obj_7questdb_7ingress_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_close *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_7ingress_Sender *__pyx_vtabptr_7questdb_7ingress_Sender;
1720: """
1721: Ingest data into QuestDB.
1722:
1723: See the :ref:`sender` documentation for more information.
1724: """
1725:
1726: # We need the Buffer held by a Sender can hold a weakref to its Sender.
1727: # This avoids a circular reference that requires the GC to clean up.
1728: cdef object __weakref__
1729:
1730: cdef line_sender_protocol _c_protocol
1731: cdef line_sender_opts* _opts
1732: cdef line_sender* _impl
1733: cdef Buffer _buffer
1734: cdef auto_flush_mode_t _auto_flush_mode
1735: cdef int64_t* _last_flush_ms
1736: cdef size_t _init_buf_size
1737: cdef size_t _max_name_len
1738: cdef bint _in_txn
1739:
+1740: cdef void_int _set_sender_fields(
static __pyx_t_7questdb_7ingress_void_int __pyx_f_7questdb_7ingress_6Sender__set_sender_fields(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, struct qdb_pystr_buf *__pyx_v_b, PyObject *__pyx_v_protocol, PyObject *__pyx_v_bind_interface, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_token, PyObject *__pyx_v_token_x, PyObject *__pyx_v_token_y, PyObject *__pyx_v_auth_timeout, PyObject *__pyx_v_tls_verify, PyObject *__pyx_v_tls_ca, PyObject *__pyx_v_tls_roots, PyObject *__pyx_v_max_buf_size, PyObject *__pyx_v_retry_timeout, PyObject *__pyx_v_request_min_throughput, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_auto_flush, PyObject *__pyx_v_auto_flush_rows, PyObject *__pyx_v_auto_flush_bytes, PyObject *__pyx_v_auto_flush_interval, PyObject *__pyx_v_init_buf_size, PyObject *__pyx_v_max_name_len) { struct line_sender_error *__pyx_v_err; PyObject *__pyx_v_user_agent = 0; struct line_sender_utf8 __pyx_v_c_user_agent; struct line_sender_utf8 __pyx_v_c_bind_interface; struct line_sender_utf8 __pyx_v_c_username; struct line_sender_utf8 __pyx_v_c_password; struct line_sender_utf8 __pyx_v_c_token; struct line_sender_utf8 __pyx_v_c_token_x; struct line_sender_utf8 __pyx_v_c_token_y; uint64_t __pyx_v_c_auth_timeout; int __pyx_v_c_tls_verify; enum line_sender_ca __pyx_v_c_tls_ca; struct line_sender_utf8 __pyx_v_c_tls_roots; uint64_t __pyx_v_c_max_buf_size; uint64_t __pyx_v_c_retry_timeout; uint64_t __pyx_v_c_request_min_throughput; uint64_t __pyx_v_c_request_timeout; __pyx_t_7questdb_7ingress_void_int __pyx_r; __Pyx_INCREF(__pyx_v_tls_roots); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("questdb.ingress.Sender._set_sender_fields", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_user_agent); __Pyx_XDECREF(__pyx_v_tls_roots); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1741: self,
1742: qdb_pystr_buf* b,
1743: object protocol,
1744: str bind_interface,
1745: str username,
1746: str password,
1747: str token,
1748: str token_x,
1749: str token_y,
1750: object auth_timeout,
1751: object tls_verify,
1752: object tls_ca,
1753: object tls_roots,
1754: object max_buf_size,
1755: object retry_timeout,
1756: object request_min_throughput,
1757: object request_timeout,
1758: object auto_flush,
1759: object auto_flush_rows,
1760: object auto_flush_bytes,
1761: object auto_flush_interval,
1762: object init_buf_size,
1763: object max_name_len) except -1:
1764: """
1765: Set optional parameters for the sender.
1766: """
+1767: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+1768: cdef str user_agent = 'questdb/python/' + VERSION
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_kp_u_questdb_python, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_2))) __PYX_ERR(0, 1768, __pyx_L1_error) __pyx_v_user_agent = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
1769: cdef line_sender_utf8 c_user_agent
1770: cdef line_sender_utf8 c_bind_interface
1771: cdef line_sender_utf8 c_username
1772: cdef line_sender_utf8 c_password
1773: cdef line_sender_utf8 c_token
1774: cdef line_sender_utf8 c_token_x
1775: cdef line_sender_utf8 c_token_y
1776: cdef uint64_t c_auth_timeout
1777: cdef bint c_tls_verify
1778: cdef line_sender_ca c_tls_ca
1779: cdef line_sender_utf8 c_tls_roots
1780: cdef uint64_t c_max_buf_size
1781: cdef uint64_t c_retry_timeout
1782: cdef uint64_t c_request_min_throughput
1783: cdef uint64_t c_request_timeout
1784:
+1785: self._c_protocol = protocol.c_value
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_c_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = ((enum line_sender_protocol)__Pyx_PyInt_As_enum__line_sender_protocol(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->_c_protocol = __pyx_t_3;
1786:
1787: # It's OK to override this setting.
+1788: str_to_utf8(b, <PyObject*>user_agent, &c_user_agent)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_user_agent), (&__pyx_v_c_user_agent)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1788, __pyx_L1_error)
+1789: if not line_sender_opts_user_agent(self._opts, c_user_agent, &err):
__pyx_t_5 = (!line_sender_opts_user_agent(__pyx_v_self->_opts, __pyx_v_c_user_agent, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1790: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1790, __pyx_L1_error)
1791:
+1792: if bind_interface is not None:
__pyx_t_5 = (__pyx_v_bind_interface != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1793: str_to_utf8(b, <PyObject*>bind_interface, &c_bind_interface)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_bind_interface), (&__pyx_v_c_bind_interface)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1793, __pyx_L1_error)
+1794: if not line_sender_opts_bind_interface(self._opts, c_bind_interface, &err):
__pyx_t_5 = (!line_sender_opts_bind_interface(__pyx_v_self->_opts, __pyx_v_c_bind_interface, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1795: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1795, __pyx_L1_error)
1796:
+1797: if username is not None:
__pyx_t_5 = (__pyx_v_username != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1798: str_to_utf8(b, <PyObject*>username, &c_username)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_username), (&__pyx_v_c_username)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1798, __pyx_L1_error)
+1799: if not line_sender_opts_username(self._opts, c_username, &err):
__pyx_t_5 = (!line_sender_opts_username(__pyx_v_self->_opts, __pyx_v_c_username, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1800: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1800, __pyx_L1_error)
1801:
+1802: if password is not None:
__pyx_t_5 = (__pyx_v_password != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1803: str_to_utf8(b, <PyObject*>password, &c_password)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_password), (&__pyx_v_c_password)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1803, __pyx_L1_error)
+1804: if not line_sender_opts_password(self._opts, c_password, &err):
__pyx_t_5 = (!line_sender_opts_password(__pyx_v_self->_opts, __pyx_v_c_password, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1805: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1805, __pyx_L1_error)
1806:
+1807: if token is not None:
__pyx_t_5 = (__pyx_v_token != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1808: str_to_utf8(b, <PyObject*>token, &c_token)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_token), (&__pyx_v_c_token)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1808, __pyx_L1_error)
+1809: if not line_sender_opts_token(self._opts, c_token, &err):
__pyx_t_5 = (!line_sender_opts_token(__pyx_v_self->_opts, __pyx_v_c_token, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1810: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1810, __pyx_L1_error)
1811:
+1812: if token_x is not None:
__pyx_t_5 = (__pyx_v_token_x != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1813: str_to_utf8(b, <PyObject*>token_x, &c_token_x)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_token_x), (&__pyx_v_c_token_x)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1813, __pyx_L1_error)
+1814: if not line_sender_opts_token_x(self._opts, c_token_x, &err):
__pyx_t_5 = (!line_sender_opts_token_x(__pyx_v_self->_opts, __pyx_v_c_token_x, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1815: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1815, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1815, __pyx_L1_error)
1816:
+1817: if token_y is not None:
__pyx_t_5 = (__pyx_v_token_y != ((PyObject*)Py_None)); if (__pyx_t_5) { /* … */ }
+1818: str_to_utf8(b, <PyObject*>token_y, &c_token_y)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_token_y), (&__pyx_v_c_token_y)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1818, __pyx_L1_error)
+1819: if not line_sender_opts_token_y(self._opts, c_token_y, &err):
__pyx_t_5 = (!line_sender_opts_token_y(__pyx_v_self->_opts, __pyx_v_c_token_y, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1820: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1820, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1820, __pyx_L1_error)
1821:
+1822: if auth_timeout is not None:
__pyx_t_5 = (__pyx_v_auth_timeout != Py_None); if (__pyx_t_5) { /* … */ }
+1823: if isinstance(auth_timeout, int):
__pyx_t_5 = PyInt_Check(__pyx_v_auth_timeout);
if (__pyx_t_5) {
/* … */
goto __pyx_L17;
}
+1824: c_auth_timeout = auth_timeout
__pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_auth_timeout); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1824, __pyx_L1_error) __pyx_v_c_auth_timeout = __pyx_t_6;
+1825: elif isinstance(auth_timeout, timedelta):
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_auth_timeout, __pyx_ptype_7cpython_8datetime_timedelta);
if (likely(__pyx_t_5)) {
/* … */
goto __pyx_L17;
}
+1826: c_auth_timeout = _timedelta_to_millis(auth_timeout)
__pyx_t_6 = __pyx_f_7questdb_7ingress__timedelta_to_millis(__pyx_v_auth_timeout); if (unlikely(__pyx_t_6 == ((uint64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1826, __pyx_L1_error) __pyx_v_c_auth_timeout = __pyx_t_6;
1827: else:
+1828: raise TypeError(
/*else*/ { /* … */ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1828, __pyx_L1_error) } __pyx_L17:;
+1829: '"auth_timeout" must be an int or a timedelta, '
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auth_timeout_must_be_an_int_or, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1830: f'not {_fqn(type(auth_timeout))}')
__pyx_t_2 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_auth_timeout)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1831: if not line_sender_opts_auth_timeout(self._opts, c_auth_timeout, &err):
__pyx_t_5 = (!line_sender_opts_auth_timeout(__pyx_v_self->_opts, __pyx_v_c_auth_timeout, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1832: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1832, __pyx_L1_error)
1833:
+1834: if tls_verify is not None:
__pyx_t_5 = (__pyx_v_tls_verify != Py_None); if (__pyx_t_5) { /* … */ }
+1835: if (tls_verify is True) or (tls_verify == 'on'):
__pyx_t_7 = (__pyx_v_tls_verify == Py_True); if (!__pyx_t_7) { } else { __pyx_t_5 = __pyx_t_7; goto __pyx_L21_bool_binop_done; } __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_tls_verify, __pyx_n_u_on, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1835, __pyx_L1_error) __pyx_t_5 = __pyx_t_7; __pyx_L21_bool_binop_done:; if (__pyx_t_5) { /* … */ goto __pyx_L20; }
+1836: c_tls_verify = True
__pyx_v_c_tls_verify = 1;
+1837: elif (tls_verify is False) or (tls_verify == 'unsafe_off'):
__pyx_t_7 = (__pyx_v_tls_verify == Py_False); if (!__pyx_t_7) { } else { __pyx_t_5 = __pyx_t_7; goto __pyx_L23_bool_binop_done; } __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_tls_verify, __pyx_n_u_unsafe_off, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1837, __pyx_L1_error) __pyx_t_5 = __pyx_t_7; __pyx_L23_bool_binop_done:; if (likely(__pyx_t_5)) { /* … */ goto __pyx_L20; }
+1838: c_tls_verify = False
__pyx_v_c_tls_verify = 0;
1839: else:
+1840: raise ValueError(
/*else*/ { /* … */ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1840, __pyx_L1_error) } __pyx_L20:;
+1841: '"tls_verify" must be a bool, "on" or "unsafe_off", '
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_tls_verify_must_be_a_bool_on_or, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1842: f'not {tls_verify!r}')
__pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_tls_verify), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1);
+1843: if not line_sender_opts_tls_verify(self._opts, c_tls_verify, &err):
__pyx_t_5 = (!line_sender_opts_tls_verify(__pyx_v_self->_opts, __pyx_v_c_tls_verify, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1844: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1844, __pyx_L1_error)
1845:
+1846: if tls_roots is not None:
__pyx_t_5 = (__pyx_v_tls_roots != Py_None); if (__pyx_t_5) { /* … */ }
+1847: tls_roots = str(tls_roots)
__pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_tls_roots); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_tls_roots, __pyx_t_1); __pyx_t_1 = 0;
+1848: str_to_utf8(b, <PyObject*>tls_roots, &c_tls_roots)
__pyx_t_4 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_tls_roots), (&__pyx_v_c_tls_roots)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1848, __pyx_L1_error)
+1849: if not line_sender_opts_tls_roots(self._opts, c_tls_roots, &err):
__pyx_t_5 = (!line_sender_opts_tls_roots(__pyx_v_self->_opts, __pyx_v_c_tls_roots, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1850: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1850, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1850, __pyx_L1_error)
1851:
+1852: if tls_ca is not None:
__pyx_t_5 = (__pyx_v_tls_ca != Py_None); if (__pyx_t_5) { /* … */ goto __pyx_L28; }
+1853: c_tls_ca = TlsCa.parse(tls_ca).c_value
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_TlsCa); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_tls_ca}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_c_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = ((enum line_sender_ca)__Pyx_PyInt_As_enum__line_sender_ca(__pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1853, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_c_tls_ca = __pyx_t_10;
+1854: if not line_sender_opts_tls_ca(self._opts, c_tls_ca, &err):
__pyx_t_5 = (!line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_c_tls_ca, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1855: raise c_err_to_py(err)
__pyx_t_8 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1855, __pyx_L1_error)
+1856: elif protocol.tls_enabled and tls_roots is None:
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_tls_enabled); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1856, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1856, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_7) { } else { __pyx_t_5 = __pyx_t_7; goto __pyx_L30_bool_binop_done; } __pyx_t_7 = (__pyx_v_tls_roots == Py_None); __pyx_t_5 = __pyx_t_7; __pyx_L30_bool_binop_done:; if (__pyx_t_5) { /* … */ } __pyx_L28:;
1857: # Set different default for Python than the the Rust default.
1858: # We don't set it if `tls_roots` is set, as it would override it.
+1859: c_tls_ca = line_sender_ca_webpki_and_os_roots
__pyx_v_c_tls_ca = line_sender_ca_webpki_and_os_roots;
+1860: if not line_sender_opts_tls_ca(self._opts, c_tls_ca, &err):
__pyx_t_5 = (!line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_c_tls_ca, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1861: raise c_err_to_py(err)
__pyx_t_8 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1861, __pyx_L1_error)
1862:
+1863: if max_buf_size is not None:
__pyx_t_5 = (__pyx_v_max_buf_size != Py_None); if (__pyx_t_5) { /* … */ }
+1864: c_max_buf_size = max_buf_size
__pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_max_buf_size); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1864, __pyx_L1_error) __pyx_v_c_max_buf_size = __pyx_t_6;
+1865: if not line_sender_opts_max_buf_size(self._opts, c_max_buf_size, &err):
__pyx_t_5 = (!line_sender_opts_max_buf_size(__pyx_v_self->_opts, __pyx_v_c_max_buf_size, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1866: raise c_err_to_py(err)
__pyx_t_8 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1866, __pyx_L1_error)
1867:
+1868: if retry_timeout is not None:
__pyx_t_5 = (__pyx_v_retry_timeout != Py_None); if (__pyx_t_5) { /* … */ }
+1869: if isinstance(retry_timeout, int):
__pyx_t_5 = PyInt_Check(__pyx_v_retry_timeout);
if (__pyx_t_5) {
/* … */
goto __pyx_L36;
}
+1870: c_retry_timeout = retry_timeout
__pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_retry_timeout); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L1_error) __pyx_v_c_retry_timeout = __pyx_t_6;
+1871: if not line_sender_opts_retry_timeout(self._opts, c_retry_timeout, &err):
__pyx_t_5 = (!line_sender_opts_retry_timeout(__pyx_v_self->_opts, __pyx_v_c_retry_timeout, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1872: raise c_err_to_py(err)
__pyx_t_8 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1872, __pyx_L1_error)
+1873: elif isinstance(retry_timeout, timedelta):
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_retry_timeout, __pyx_ptype_7cpython_8datetime_timedelta);
if (likely(__pyx_t_5)) {
/* … */
goto __pyx_L36;
}
+1874: c_retry_timeout = _timedelta_to_millis(retry_timeout)
__pyx_t_6 = __pyx_f_7questdb_7ingress__timedelta_to_millis(__pyx_v_retry_timeout); if (unlikely(__pyx_t_6 == ((uint64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1874, __pyx_L1_error) __pyx_v_c_retry_timeout = __pyx_t_6;
+1875: if not line_sender_opts_retry_timeout(self._opts, c_retry_timeout, &err):
__pyx_t_5 = (!line_sender_opts_retry_timeout(__pyx_v_self->_opts, __pyx_v_c_retry_timeout, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1876: raise c_err_to_py(err)
__pyx_t_8 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1876, __pyx_L1_error)
1877: else:
+1878: raise TypeError(
/*else*/ { /* … */ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1878, __pyx_L1_error) } __pyx_L36:;
+1879: '"retry_timeout" must be an int or a timedelta, '
__pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_retry_timeout_must_be_an_int_or, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1880: f'not {_fqn(type(retry_timeout))}')
__pyx_t_8 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_retry_timeout)))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1881:
+1882: if request_min_throughput is not None:
__pyx_t_5 = (__pyx_v_request_min_throughput != Py_None); if (__pyx_t_5) { /* … */ }
+1883: c_request_min_throughput = request_min_throughput
__pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_request_min_throughput); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1883, __pyx_L1_error) __pyx_v_c_request_min_throughput = __pyx_t_6;
+1884: if not line_sender_opts_request_min_throughput(self._opts, c_request_min_throughput, &err):
__pyx_t_5 = (!line_sender_opts_request_min_throughput(__pyx_v_self->_opts, __pyx_v_c_request_min_throughput, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1885: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1885, __pyx_L1_error)
1886:
+1887: if request_timeout is not None:
__pyx_t_5 = (__pyx_v_request_timeout != Py_None); if (__pyx_t_5) { /* … */ }
+1888: if isinstance(request_timeout, int):
__pyx_t_5 = PyInt_Check(__pyx_v_request_timeout);
if (__pyx_t_5) {
/* … */
goto __pyx_L42;
}
+1889: c_request_timeout = request_timeout
__pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_request_timeout); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1889, __pyx_L1_error) __pyx_v_c_request_timeout = __pyx_t_6;
+1890: if not line_sender_opts_request_timeout(self._opts, c_request_timeout, &err):
__pyx_t_5 = (!line_sender_opts_request_timeout(__pyx_v_self->_opts, __pyx_v_c_request_timeout, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1891: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1891, __pyx_L1_error)
+1892: elif isinstance(request_timeout, timedelta):
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_request_timeout, __pyx_ptype_7cpython_8datetime_timedelta);
if (likely(__pyx_t_5)) {
/* … */
goto __pyx_L42;
}
+1893: c_request_timeout = _timedelta_to_millis(request_timeout)
__pyx_t_6 = __pyx_f_7questdb_7ingress__timedelta_to_millis(__pyx_v_request_timeout); if (unlikely(__pyx_t_6 == ((uint64_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1893, __pyx_L1_error) __pyx_v_c_request_timeout = __pyx_t_6;
+1894: if not line_sender_opts_request_timeout(self._opts, c_request_timeout, &err):
__pyx_t_5 = (!line_sender_opts_request_timeout(__pyx_v_self->_opts, __pyx_v_c_request_timeout, (&__pyx_v_err))); if (unlikely(__pyx_t_5)) { /* … */ }
+1895: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1895, __pyx_L1_error)
1896: else:
+1897: raise TypeError(
/*else*/ { /* … */ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 1897, __pyx_L1_error) } __pyx_L42:;
+1898: '"request_timeout" must be an int or a timedelta, '
__pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_request_timeout_must_be_an_int, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+1899: f'not {_fqn(type(request_timeout))}')
__pyx_t_1 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_request_timeout)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1900:
+1901: _parse_auto_flush(
__pyx_t_4 = __pyx_f_7questdb_7ingress__parse_auto_flush(__pyx_v_self->_c_protocol, __pyx_v_auto_flush, __pyx_v_auto_flush_rows, __pyx_v_auto_flush_bytes, __pyx_v_auto_flush_interval, (&__pyx_v_self->_auto_flush_mode)); if (unlikely(__pyx_t_4 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1901, __pyx_L1_error)
1902: self._c_protocol,
1903: auto_flush,
1904: auto_flush_rows,
1905: auto_flush_bytes,
1906: auto_flush_interval,
1907: &self._auto_flush_mode)
1908:
+1909: self._init_buf_size = init_buf_size or 65536
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_init_buf_size); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1909, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_12 = __Pyx_PyInt_As_size_t(__pyx_v_init_buf_size); if (unlikely((__pyx_t_12 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1909, __pyx_L1_error) __pyx_t_11 = __pyx_t_12; goto __pyx_L45_bool_binop_done; } __pyx_t_11 = 0x10000; __pyx_L45_bool_binop_done:; __pyx_v_self->_init_buf_size = __pyx_t_11;
+1910: self._max_name_len = max_name_len or 127
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_max_name_len); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1910, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_12 = __Pyx_PyInt_As_size_t(__pyx_v_max_name_len); if (unlikely((__pyx_t_12 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1910, __pyx_L1_error) __pyx_t_11 = __pyx_t_12; goto __pyx_L47_bool_binop_done; } __pyx_t_11 = 0x7F; __pyx_L47_bool_binop_done:; __pyx_v_self->_max_name_len = __pyx_t_11;
+1911: self._buffer = Buffer(
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer), __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_buffer); __Pyx_DECREF((PyObject *)__pyx_v_self->_buffer); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_t_1); __pyx_t_1 = 0;
+1912: init_buf_size=self._init_buf_size,
__pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_buf_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_init_buf_size, __pyx_t_1) < 0) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1913: max_name_len=self._max_name_len)
__pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_max_name_len, __pyx_t_1) < 0) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1914: self._last_flush_ms = <int64_t*>calloc(1, sizeof(int64_t))
__pyx_v_self->_last_flush_ms = ((int64_t *)calloc(1, (sizeof(int64_t))));
1915:
+1916: def __cinit__(self):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender___cinit__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_6Sender___cinit__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1917: self._c_protocol = line_sender_protocol_tcp
__pyx_v_self->_c_protocol = line_sender_protocol_tcp;
+1918: self._opts = NULL
__pyx_v_self->_opts = NULL;
+1919: self._impl = NULL
__pyx_v_self->_impl = NULL;
+1920: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF((PyObject *)__pyx_v_self->_buffer); __Pyx_DECREF((PyObject *)__pyx_v_self->_buffer); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None);
+1921: self._auto_flush_mode.enabled = False
__pyx_v_self->_auto_flush_mode.enabled = 0;
+1922: self._last_flush_ms = NULL
__pyx_v_self->_last_flush_ms = NULL;
+1923: self._init_buf_size = 0
__pyx_v_self->_init_buf_size = 0;
+1924: self._max_name_len = 0
__pyx_v_self->_max_name_len = 0;
+1925: self._in_txn = False
__pyx_v_self->_in_txn = 0;
1926:
+1927: def __init__(
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_6Sender_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_6Sender_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_protocol = 0; PyObject *__pyx_v_host = 0; PyObject *__pyx_v_port = 0; PyObject *__pyx_v_bind_interface = 0; PyObject *__pyx_v_username = 0; PyObject *__pyx_v_password = 0; PyObject *__pyx_v_token = 0; PyObject *__pyx_v_token_x = 0; PyObject *__pyx_v_token_y = 0; PyObject *__pyx_v_auth_timeout = 0; PyObject *__pyx_v_tls_verify = 0; PyObject *__pyx_v_tls_ca = 0; PyObject *__pyx_v_tls_roots = 0; PyObject *__pyx_v_max_buf_size = 0; PyObject *__pyx_v_retry_timeout = 0; PyObject *__pyx_v_request_min_throughput = 0; PyObject *__pyx_v_request_timeout = 0; PyObject *__pyx_v_auto_flush = 0; PyObject *__pyx_v_auto_flush_rows = 0; PyObject *__pyx_v_auto_flush_bytes = 0; PyObject *__pyx_v_auto_flush_interval = 0; PyObject *__pyx_v_init_buf_size = 0; PyObject *__pyx_v_max_name_len = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_protocol,&__pyx_n_s_host,&__pyx_n_s_port,&__pyx_n_s_bind_interface,&__pyx_n_s_username,&__pyx_n_s_password,&__pyx_n_s_token,&__pyx_n_s_token_x,&__pyx_n_s_token_y,&__pyx_n_s_auth_timeout,&__pyx_n_s_tls_verify,&__pyx_n_s_tls_ca,&__pyx_n_s_tls_roots,&__pyx_n_s_max_buf_size,&__pyx_n_s_retry_timeout,&__pyx_n_s_request_min_throughput,&__pyx_n_s_request_timeout,&__pyx_n_s_auto_flush,&__pyx_n_s_auto_flush_rows,&__pyx_n_s_auto_flush_bytes,&__pyx_n_s_auto_flush_interval,&__pyx_n_s_init_buf_size,&__pyx_n_s_max_name_len,0}; PyObject* values[23] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_6Sender_2__init__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_protocol, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_bind_interface, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_token, PyObject *__pyx_v_token_x, PyObject *__pyx_v_token_y, PyObject *__pyx_v_auth_timeout, PyObject *__pyx_v_tls_verify, PyObject *__pyx_v_tls_ca, PyObject *__pyx_v_tls_roots, PyObject *__pyx_v_max_buf_size, PyObject *__pyx_v_retry_timeout, PyObject *__pyx_v_request_min_throughput, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_auto_flush, PyObject *__pyx_v_auto_flush_rows, PyObject *__pyx_v_auto_flush_bytes, PyObject *__pyx_v_auto_flush_interval, PyObject *__pyx_v_init_buf_size, PyObject *__pyx_v_max_name_len) { struct line_sender_utf8 __pyx_v_c_host; PyObject *__pyx_v_port_str = 0; enum line_sender_protocol __pyx_v_c_protocol; struct line_sender_utf8 __pyx_v_c_port; struct qdb_pystr_buf *__pyx_v_b; int __pyx_r; __Pyx_INCREF(__pyx_v_protocol); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Sender.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_port_str); __Pyx_XDECREF(__pyx_v_protocol); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1928: self,
1929: object protocol,
1930: str host,
1931: object port,
1932: *,
+1933: str bind_interface=None,
values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1934: str username=None,
values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1935: str password=None,
values[5] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1936: str token=None,
values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1937: str token_x=None,
values[7] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1938: str token_y=None,
values[8] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)Py_None));
+1939: object auth_timeout=None, # default: 15000 milliseconds
values[9] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1940: object tls_verify=None, # default: True
values[10] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1941: object tls_ca=None, # default: TlsCa.WebpkiRoots
values[11] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1942: object tls_roots=None,
values[12] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1943: object max_buf_size=None, # 100 * 1024 * 1024 - 100MiB
values[13] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1944: object retry_timeout=None, # default: 10000 milliseconds
values[14] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1945: object request_min_throughput=None, # default: 100 * 1024 - 100KiB/s
values[15] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1946: object request_timeout=None,
values[16] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1947: object auto_flush=None, # Default True
values[17] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1948: object auto_flush_rows=None, # Default 75000 (HTTP) or 600 (TCP)
values[18] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1949: object auto_flush_bytes=None, # Default off
values[19] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1950: object auto_flush_interval=None, # Default 1000 milliseconds
values[20] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1951: object init_buf_size=None, # 64KiB
values[21] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
+1952: object max_name_len=None): # 127
values[22] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_protocol)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_host)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 1927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_port)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[2]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 1927, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 20)) { Py_ssize_t index; for (index = 3; index < 23 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 1927, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); } __pyx_v_protocol = values[0]; __pyx_v_host = ((PyObject*)values[1]); __pyx_v_port = values[2]; __pyx_v_bind_interface = ((PyObject*)values[3]); __pyx_v_username = ((PyObject*)values[4]); __pyx_v_password = ((PyObject*)values[5]); __pyx_v_token = ((PyObject*)values[6]); __pyx_v_token_x = ((PyObject*)values[7]); __pyx_v_token_y = ((PyObject*)values[8]); __pyx_v_auth_timeout = values[9]; __pyx_v_tls_verify = values[10]; __pyx_v_tls_ca = values[11]; __pyx_v_tls_roots = values[12]; __pyx_v_max_buf_size = values[13]; __pyx_v_retry_timeout = values[14]; __pyx_v_request_min_throughput = values[15]; __pyx_v_request_timeout = values[16]; __pyx_v_auto_flush = values[17]; __pyx_v_auto_flush_rows = values[18]; __pyx_v_auto_flush_bytes = values[19]; __pyx_v_auto_flush_interval = values[20]; __pyx_v_init_buf_size = values[21]; __pyx_v_max_name_len = values[22]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1927, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_host), (&PyUnicode_Type), 1, "host", 1))) __PYX_ERR(0, 1930, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bind_interface), (&PyUnicode_Type), 1, "bind_interface", 1))) __PYX_ERR(0, 1933, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_username), (&PyUnicode_Type), 1, "username", 1))) __PYX_ERR(0, 1934, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_password), (&PyUnicode_Type), 1, "password", 1))) __PYX_ERR(0, 1935, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token), (&PyUnicode_Type), 1, "token", 1))) __PYX_ERR(0, 1936, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_x), (&PyUnicode_Type), 1, "token_x", 1))) __PYX_ERR(0, 1937, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_y), (&PyUnicode_Type), 1, "token_y", 1))) __PYX_ERR(0, 1938, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_2__init__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_protocol, __pyx_v_host, __pyx_v_port, __pyx_v_bind_interface, __pyx_v_username, __pyx_v_password, __pyx_v_token, __pyx_v_token_x, __pyx_v_token_y, __pyx_v_auth_timeout, __pyx_v_tls_verify, __pyx_v_tls_ca, __pyx_v_tls_roots, __pyx_v_max_buf_size, __pyx_v_retry_timeout, __pyx_v_request_min_throughput, __pyx_v_request_timeout, __pyx_v_auto_flush, __pyx_v_auto_flush_rows, __pyx_v_auto_flush_bytes, __pyx_v_auto_flush_interval, __pyx_v_init_buf_size, __pyx_v_max_name_len);
1953:
1954: cdef line_sender_utf8 c_host
1955: cdef str port_str
1956: cdef line_sender_protocol c_protocol
1957: cdef line_sender_utf8 c_port
+1958: cdef qdb_pystr_buf* b = qdb_pystr_buf_new()
__pyx_v_b = qdb_pystr_buf_new();
+1959: try:
/*try:*/ {
+1960: protocol = Protocol.parse(protocol)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1960, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1960, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_protocol}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1960, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF_SET(__pyx_v_protocol, __pyx_t_1); __pyx_t_1 = 0;
+1961: c_protocol = protocol.c_value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_c_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1961, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = ((enum line_sender_protocol)__Pyx_PyInt_As_enum__line_sender_protocol(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1961, __pyx_L4_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c_protocol = __pyx_t_5;
+1962: if PyLong_CheckExact(<PyObject*>port):
__pyx_t_6 = PyLong_CheckExact(((PyObject *)__pyx_v_port));
if (__pyx_t_6) {
/* … */
goto __pyx_L6;
}
+1963: port_str = str(port)
__pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_port); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1963, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_port_str = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+1964: elif PyUnicode_CheckExact(<PyObject*>port):
__pyx_t_6 = PyUnicode_CheckExact(((PyObject *)__pyx_v_port));
if (likely(__pyx_t_6)) {
/* … */
goto __pyx_L6;
}
+1965: port_str = port
if (!(likely(PyUnicode_CheckExact(__pyx_v_port))||((__pyx_v_port) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_port))) __PYX_ERR(0, 1965, __pyx_L4_error) __pyx_t_1 = __pyx_v_port; __Pyx_INCREF(__pyx_t_1); __pyx_v_port_str = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
1966: else:
+1967: raise TypeError(
/*else*/ { /* … */ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1967, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1967, __pyx_L4_error) } __pyx_L6:;
+1968: f'port must be an int or a str, not {_fqn(type(port))}')
__pyx_t_1 = __pyx_f_7questdb_7ingress__fqn(((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_port)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1968, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1968, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_port_must_be_an_int_or_a_str_not, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1968, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1969: str_to_utf8(b, <PyObject*>host, &c_host)
__pyx_t_7 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_host), (&__pyx_v_c_host)); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1969, __pyx_L4_error)
+1970: str_to_utf8(b, <PyObject*>port_str, &c_port)
__pyx_t_7 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_port_str), (&__pyx_v_c_port)); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1970, __pyx_L4_error)
+1971: self._opts = line_sender_opts_new_service(c_protocol, c_host, c_port)
__pyx_v_self->_opts = line_sender_opts_new_service(__pyx_v_c_protocol, __pyx_v_c_host, __pyx_v_c_port);
1972:
+1973: self._set_sender_fields(
__pyx_t_7 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_set_sender_fields(__pyx_v_self, __pyx_v_b, __pyx_v_protocol, __pyx_v_bind_interface, __pyx_v_username, __pyx_v_password, __pyx_v_token, __pyx_v_token_x, __pyx_v_token_y, __pyx_v_auth_timeout, __pyx_v_tls_verify, __pyx_v_tls_ca, __pyx_v_tls_roots, __pyx_v_max_buf_size, __pyx_v_retry_timeout, __pyx_v_request_min_throughput, __pyx_v_request_timeout, __pyx_v_auto_flush, __pyx_v_auto_flush_rows, __pyx_v_auto_flush_bytes, __pyx_v_auto_flush_interval, __pyx_v_init_buf_size, __pyx_v_max_name_len); if (unlikely(__pyx_t_7 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 1973, __pyx_L4_error)
}
1974: b,
1975: protocol,
1976: bind_interface,
1977: username,
1978: password,
1979: token,
1980: token_x,
1981: token_y,
1982: auth_timeout,
1983: tls_verify,
1984: tls_ca,
1985: tls_roots,
1986: max_buf_size,
1987: retry_timeout,
1988: request_min_throughput,
1989: request_timeout,
1990: auto_flush,
1991: auto_flush_rows,
1992: auto_flush_bytes,
1993: auto_flush_interval,
1994: init_buf_size,
1995: max_name_len)
1996: finally:
+1997: qdb_pystr_buf_free(b)
/*finally:*/ { /*normal exit:*/{ qdb_pystr_buf_free(__pyx_v_b); goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { qdb_pystr_buf_free(__pyx_v_b); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13); __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10; goto __pyx_L1_error; } __pyx_L5:; }
1998:
+1999: @staticmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_5from_conf(CYTHON_UNUSED PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_4from_conf, "\n Construct a sender from a :ref:`configuration string <sender_conf>`.\n\n The additional arguments are used to specify additional parameters\n which are not present in the configuration string.\n\n Note that any parameters already present in the configuration string\n cannot be overridden.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_5from_conf = {"from_conf", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_5from_conf, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_4from_conf}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_5from_conf(CYTHON_UNUSED PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_conf_str = 0; PyObject *__pyx_v_bind_interface = 0; PyObject *__pyx_v_username = 0; PyObject *__pyx_v_password = 0; PyObject *__pyx_v_token = 0; PyObject *__pyx_v_token_x = 0; PyObject *__pyx_v_token_y = 0; PyObject *__pyx_v_auth_timeout = 0; PyObject *__pyx_v_tls_verify = 0; PyObject *__pyx_v_tls_ca = 0; PyObject *__pyx_v_tls_roots = 0; PyObject *__pyx_v_max_buf_size = 0; PyObject *__pyx_v_retry_timeout = 0; PyObject *__pyx_v_request_min_throughput = 0; PyObject *__pyx_v_request_timeout = 0; PyObject *__pyx_v_auto_flush = 0; PyObject *__pyx_v_auto_flush_rows = 0; PyObject *__pyx_v_auto_flush_bytes = 0; PyObject *__pyx_v_auto_flush_interval = 0; PyObject *__pyx_v_init_buf_size = 0; PyObject *__pyx_v_max_name_len = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_conf (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_conf_str,&__pyx_n_s_bind_interface,&__pyx_n_s_username,&__pyx_n_s_password,&__pyx_n_s_token,&__pyx_n_s_token_x,&__pyx_n_s_token_y,&__pyx_n_s_auth_timeout,&__pyx_n_s_tls_verify,&__pyx_n_s_tls_ca,&__pyx_n_s_tls_roots,&__pyx_n_s_max_buf_size,&__pyx_n_s_retry_timeout,&__pyx_n_s_request_min_throughput,&__pyx_n_s_request_timeout,&__pyx_n_s_auto_flush,&__pyx_n_s_auto_flush_rows,&__pyx_n_s_auto_flush_bytes,&__pyx_n_s_auto_flush_interval,&__pyx_n_s_init_buf_size,&__pyx_n_s_max_name_len,0}; PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_4from_conf(PyObject *__pyx_v_conf_str, PyObject *__pyx_v_bind_interface, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_token, PyObject *__pyx_v_token_x, PyObject *__pyx_v_token_y, PyObject *__pyx_v_auth_timeout, PyObject *__pyx_v_tls_verify, PyObject *__pyx_v_tls_ca, PyObject *__pyx_v_tls_roots, PyObject *__pyx_v_max_buf_size, PyObject *__pyx_v_retry_timeout, PyObject *__pyx_v_request_min_throughput, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_auto_flush, PyObject *__pyx_v_auto_flush_rows, PyObject *__pyx_v_auto_flush_bytes, PyObject *__pyx_v_auto_flush_interval, PyObject *__pyx_v_init_buf_size, PyObject *__pyx_v_max_name_len) { struct line_sender_error *__pyx_v_err; PyObject *__pyx_v_protocol = 0; struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_sender = 0; PyObject *__pyx_v_synthetic_conf_str = 0; struct line_sender_utf8 __pyx_v_c_synthetic_conf_str; PyObject *__pyx_v_params = 0; struct qdb_pystr_buf *__pyx_v_b; PyObject *__pyx_v_addr = NULL; PyObject *__pyx_v_override_key = NULL; PyObject *__pyx_v_override_value = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_16); __Pyx_XDECREF(__pyx_t_17); __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); __Pyx_XDECREF(__pyx_t_22); __Pyx_XDECREF(__pyx_t_23); __Pyx_XDECREF(__pyx_t_24); __Pyx_XDECREF(__pyx_t_25); __Pyx_XDECREF(__pyx_t_26); __Pyx_XDECREF(__pyx_t_27); __Pyx_XDECREF(__pyx_t_28); __Pyx_XDECREF(__pyx_t_29); __Pyx_XDECREF(__pyx_t_30); __Pyx_AddTraceback("questdb.ingress.Sender.from_conf", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_protocol); __Pyx_XDECREF((PyObject *)__pyx_v_sender); __Pyx_XDECREF(__pyx_v_synthetic_conf_str); __Pyx_XDECREF(__pyx_v_params); __Pyx_XDECREF(__pyx_v_addr); __Pyx_XDECREF(__pyx_v_override_key); __Pyx_XDECREF(__pyx_v_override_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__93 = PyTuple_Pack(31, __pyx_n_s_conf_str, __pyx_n_s_bind_interface, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_token, __pyx_n_s_token_x, __pyx_n_s_token_y, __pyx_n_s_auth_timeout, __pyx_n_s_tls_verify, __pyx_n_s_tls_ca, __pyx_n_s_tls_roots, __pyx_n_s_max_buf_size, __pyx_n_s_retry_timeout, __pyx_n_s_request_min_throughput, __pyx_n_s_request_timeout, __pyx_n_s_auto_flush, __pyx_n_s_auto_flush_rows, __pyx_n_s_auto_flush_bytes, __pyx_n_s_auto_flush_interval, __pyx_n_s_init_buf_size, __pyx_n_s_max_name_len, __pyx_n_s_err, __pyx_n_s_protocol, __pyx_n_s_sender, __pyx_n_s_synthetic_conf_str, __pyx_n_s_c_synthetic_conf_str, __pyx_n_s_params, __pyx_n_s_b, __pyx_n_s_addr, __pyx_n_s_override_key, __pyx_n_s_override_value); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__93); __Pyx_GIVEREF(__pyx_tuple__93); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_5from_conf, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_from_conf, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_3, __pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_conf, __pyx_t_3) < 0) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_conf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_conf, __pyx_t_19) < 0) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(1, 0, 20, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_conf, 1999, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 1999, __pyx_L1_error)
2000: def from_conf(
2001: str conf_str,
2002: *,
+2003: str bind_interface=None,
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_bind_interface, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2004: str username=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_username, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2005: str password=None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_password, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2006: str token=None,
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2007: str token_x=None,
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token_x, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2008: str token_y=None,
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token_y, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2009: object auth_timeout=None, # default: 15000 milliseconds
values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auth_timeout, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2010: object tls_verify=None, # default: True
values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_verify, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2011: object tls_ca=None, # default: TlsCa.WebpkiRoots
values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_ca, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2012: object tls_roots=None,
values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_roots, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2013: object max_buf_size=None, # 100 * 1024 * 1024 - 100MiB
values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_max_buf_size, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2014: object retry_timeout=None, # default: 10000 milliseconds
values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_retry_timeout, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2015: object request_min_throughput=None, # default: 100 * 1024 - 100KiB/s
values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_request_min_throughput, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2016: object request_timeout=None,
values[14] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_request_timeout, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2017: object auto_flush=None, # Default True
values[15] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2018: object auto_flush_rows=None, # Default 75000 (HTTP) or 600 (TCP)
values[16] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_rows, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2019: object auto_flush_bytes=None, # Default off
values[17] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_bytes, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2020: object auto_flush_interval=None, # Default 1000 milliseconds
values[18] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_interval, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2021: object init_buf_size=None, # 64KiB
values[19] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_init_buf_size, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
+2022: object max_name_len=None): # 127
values[20] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_conf_str)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1999, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (kw_args > 0 && likely(kw_args <= 20)) { Py_ssize_t index; for (index = 1; index < 21 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1999, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "from_conf") < 0)) __PYX_ERR(0, 1999, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_conf_str = ((PyObject*)values[0]); __pyx_v_bind_interface = ((PyObject*)values[1]); __pyx_v_username = ((PyObject*)values[2]); __pyx_v_password = ((PyObject*)values[3]); __pyx_v_token = ((PyObject*)values[4]); __pyx_v_token_x = ((PyObject*)values[5]); __pyx_v_token_y = ((PyObject*)values[6]); __pyx_v_auth_timeout = values[7]; __pyx_v_tls_verify = values[8]; __pyx_v_tls_ca = values[9]; __pyx_v_tls_roots = values[10]; __pyx_v_max_buf_size = values[11]; __pyx_v_retry_timeout = values[12]; __pyx_v_request_min_throughput = values[13]; __pyx_v_request_timeout = values[14]; __pyx_v_auto_flush = values[15]; __pyx_v_auto_flush_rows = values[16]; __pyx_v_auto_flush_bytes = values[17]; __pyx_v_auto_flush_interval = values[18]; __pyx_v_init_buf_size = values[19]; __pyx_v_max_name_len = values[20]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("from_conf", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1999, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.from_conf", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_conf_str), (&PyUnicode_Type), 1, "conf_str", 1))) __PYX_ERR(0, 2001, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bind_interface), (&PyUnicode_Type), 1, "bind_interface", 1))) __PYX_ERR(0, 2003, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_username), (&PyUnicode_Type), 1, "username", 1))) __PYX_ERR(0, 2004, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_password), (&PyUnicode_Type), 1, "password", 1))) __PYX_ERR(0, 2005, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token), (&PyUnicode_Type), 1, "token", 1))) __PYX_ERR(0, 2006, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_x), (&PyUnicode_Type), 1, "token_x", 1))) __PYX_ERR(0, 2007, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_y), (&PyUnicode_Type), 1, "token_y", 1))) __PYX_ERR(0, 2008, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_4from_conf(__pyx_v_conf_str, __pyx_v_bind_interface, __pyx_v_username, __pyx_v_password, __pyx_v_token, __pyx_v_token_x, __pyx_v_token_y, __pyx_v_auth_timeout, __pyx_v_tls_verify, __pyx_v_tls_ca, __pyx_v_tls_roots, __pyx_v_max_buf_size, __pyx_v_retry_timeout, __pyx_v_request_min_throughput, __pyx_v_request_timeout, __pyx_v_auto_flush, __pyx_v_auto_flush_rows, __pyx_v_auto_flush_bytes, __pyx_v_auto_flush_interval, __pyx_v_init_buf_size, __pyx_v_max_name_len); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_max_name_len, Py_None) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
2023: """
2024: Construct a sender from a :ref:`configuration string <sender_conf>`.
2025:
2026: The additional arguments are used to specify additional parameters
2027: which are not present in the configuration string.
2028:
2029: Note that any parameters already present in the configuration string
2030: cannot be overridden.
2031: """
2032:
+2033: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
2034: cdef object protocol
2035: cdef Sender sender
2036: cdef str synthetic_conf_str
2037: cdef line_sender_utf8 c_synthetic_conf_str
2038: cdef dict params
+2039: cdef qdb_pystr_buf* b = qdb_pystr_buf_new()
__pyx_v_b = qdb_pystr_buf_new();
+2040: try:
/*try:*/ {
+2041: protocol, params = parse_conf_str(b, conf_str)
__pyx_t_1 = __pyx_f_7questdb_7ingress_parse_conf_str(__pyx_v_b, __pyx_v_conf_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2041, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 2041, __pyx_L4_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2041, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2041, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2041, __pyx_L4_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L7_unpacking_done; __pyx_L6_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 2041, __pyx_L4_error) __pyx_L7_unpacking_done:; } if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_3))) __PYX_ERR(0, 2041, __pyx_L4_error) __pyx_v_protocol = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_params = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
2042:
+2043: addr = params.get('addr')
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2043, __pyx_L4_error) } __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_addr, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_addr = __pyx_t_1; __pyx_t_1 = 0;
+2044: if addr is None:
__pyx_t_6 = (__pyx_v_addr == Py_None); if (unlikely(__pyx_t_6)) { /* … */ }
+2045: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2045, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3);
+2046: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2046, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2046, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_4, __pyx_kp_u_Missing_addr_parameter_in_config}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2045, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2045, __pyx_L4_error)
2047: 'Missing "addr" parameter in config string')
2048:
+2049: if 'tls_roots_password' in params:
if (unlikely(__pyx_v_params == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 2049, __pyx_L4_error) } __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_n_u_tls_roots_password, __pyx_v_params, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2049, __pyx_L4_error) if (unlikely(__pyx_t_6)) { /* … */ }
+2050: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2050, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3);
+2051: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2051, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2051, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_kp_u_tls_roots_password_is_not_suppo}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2050, __pyx_L4_error)
2052: '"tls_roots_password" is not supported in the conf_str.')
2053:
2054: # add fields to the dictionary, so long as they aren't already
2055: # present in the params dictionary
+2056: for override_key, override_value in {
__pyx_t_8 = 0; /* … */ while (1) { /* … */ __Pyx_XDECREF_SET(__pyx_v_override_key, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_override_value, __pyx_t_3); __pyx_t_3 = 0;
+2057: 'bind_interface': bind_interface,
__pyx_t_3 = __Pyx_PyDict_NewPresized(20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2057, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_bind_interface, __pyx_v_bind_interface) < 0) __PYX_ERR(0, 2057, __pyx_L4_error) /* … */ __pyx_t_2 = __Pyx_dict_iterator(__pyx_t_3, 1, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2057, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; /* … */ __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_8, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_10); if (unlikely(__pyx_t_11 == 0)) break; if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 2057, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
+2058: 'username': username,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_username, __pyx_v_username) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2059: 'password': password,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_password, __pyx_v_password) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2060: 'token': token,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_token, __pyx_v_token) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2061: 'token_x': token_x,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_token_x, __pyx_v_token_x) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2062: 'token_y': token_y,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_token_y, __pyx_v_token_y) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2063: 'auth_timeout': auth_timeout,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_auth_timeout, __pyx_v_auth_timeout) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2064: 'tls_verify': tls_verify,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_tls_verify, __pyx_v_tls_verify) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2065: 'tls_ca': tls_ca,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_tls_ca, __pyx_v_tls_ca) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2066: 'tls_roots': tls_roots,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_tls_roots, __pyx_v_tls_roots) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2067: 'max_buf_size': max_buf_size,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_max_buf_size, __pyx_v_max_buf_size) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2068: 'retry_timeout': retry_timeout,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_retry_timeout, __pyx_v_retry_timeout) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2069: 'request_min_throughput': request_min_throughput,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_request_min_throughput, __pyx_v_request_min_throughput) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2070: 'request_timeout': request_timeout,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_request_timeout, __pyx_v_request_timeout) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2071: 'auto_flush': auto_flush,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_auto_flush, __pyx_v_auto_flush) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2072: 'auto_flush_rows': auto_flush_rows,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_auto_flush_rows, __pyx_v_auto_flush_rows) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2073: 'auto_flush_bytes': auto_flush_bytes,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_auto_flush_bytes, __pyx_v_auto_flush_bytes) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2074: 'auto_flush_interval': auto_flush_interval,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_auto_flush_interval, __pyx_v_auto_flush_interval) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2075: 'init_buf_size': init_buf_size,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_init_buf_size, __pyx_v_init_buf_size) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
+2076: 'max_name_len': max_name_len,
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_max_name_len, __pyx_v_max_name_len) < 0) __PYX_ERR(0, 2057, __pyx_L4_error)
2077: }.items():
+2078: if override_value is None:
__pyx_t_6 = (__pyx_v_override_value == Py_None); if (__pyx_t_6) { /* … */ }
+2079: continue
goto __pyx_L10_continue;
+2080: if override_key in params:
if (unlikely(__pyx_v_params == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 2080, __pyx_L4_error) } __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_v_override_key, __pyx_v_params, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2080, __pyx_L4_error) if (unlikely(__pyx_t_6)) { /* … */ }
+2081: raise ValueError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2081, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2081, __pyx_L4_error)
+2082: f'"{override_key}" is already present in the conf_str '
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2082, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_12 = 0; __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u__37); __pyx_t_12 += 1; __Pyx_GIVEREF(__pyx_kp_u__37); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__37); __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_override_key, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2082, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13; __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u_is_already_present_in_the_conf); __pyx_t_12 += 62; __Pyx_GIVEREF(__pyx_kp_u_is_already_present_in_the_conf); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_is_already_present_in_the_conf); __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2082, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2083: 'and cannot be overridden.')
+2084: params[override_key] = override_value
if (unlikely(__pyx_v_params == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 2084, __pyx_L4_error) } if (unlikely((PyDict_SetItem(__pyx_v_params, __pyx_v_override_key, __pyx_v_override_value) < 0))) __PYX_ERR(0, 2084, __pyx_L4_error) __pyx_L10_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2085:
+2086: sender = Sender.__new__(Sender)
__pyx_t_1 = ((PyObject *)__pyx_tp_new_7questdb_7ingress_Sender(((PyTypeObject *)__pyx_ptype_7questdb_7ingress_Sender), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L4_error) __Pyx_GOTREF((PyObject *)__pyx_t_1); __pyx_v_sender = ((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_t_1); __pyx_t_1 = 0;
2087:
2088: # Forward only the `addr=` parameter to the C API.
+2089: synthetic_conf_str = f'{protocol.tag}::addr={addr};'
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2089, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = 0; __pyx_t_13 = 127; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2089, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2089, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13; __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u_addr_2); __pyx_t_9 += 7; __Pyx_GIVEREF(__pyx_kp_u_addr_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_addr_2); __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_addr, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2089, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13; __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u__38); __pyx_t_9 += 1; __Pyx_GIVEREF(__pyx_kp_u__38); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__38); __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2089, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_synthetic_conf_str = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+2090: str_to_utf8(b, <PyObject*>synthetic_conf_str, &c_synthetic_conf_str)
__pyx_t_14 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_b, ((PyObject *)__pyx_v_synthetic_conf_str), (&__pyx_v_c_synthetic_conf_str)); if (unlikely(__pyx_t_14 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 2090, __pyx_L4_error)
+2091: sender._opts = line_sender_opts_from_conf(
__pyx_v_sender->_opts = line_sender_opts_from_conf(__pyx_v_c_synthetic_conf_str, (&__pyx_v_err));
2092: c_synthetic_conf_str, &err)
2093:
+2094: sender._set_sender_fields(
__pyx_t_14 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_sender->__pyx_vtab)->_set_sender_fields(__pyx_v_sender, __pyx_v_b, __pyx_v_protocol, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_15), ((PyObject*)__pyx_t_16), __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30); if (unlikely(__pyx_t_14 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 2094, __pyx_L4_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
2095: b,
2096: protocol,
+2097: params.get('bind_interface'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2097, __pyx_L4_error) } __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_bind_interface, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2097, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_2))) __PYX_ERR(0, 2097, __pyx_L4_error)
+2098: params.get('username'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2098, __pyx_L4_error) } __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_username, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2098, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(0, 2098, __pyx_L4_error)
+2099: params.get('password'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2099, __pyx_L4_error) } __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_password, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2099, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_3))) __PYX_ERR(0, 2099, __pyx_L4_error)
+2100: params.get('token'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2100, __pyx_L4_error) } __pyx_t_4 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_token, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_4))) __PYX_ERR(0, 2100, __pyx_L4_error)
+2101: params.get('token_x'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2101, __pyx_L4_error) } __pyx_t_15 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_token_x, Py_None); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2101, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_15); if (!(likely(PyUnicode_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_15))) __PYX_ERR(0, 2101, __pyx_L4_error)
+2102: params.get('token_y'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2102, __pyx_L4_error) } __pyx_t_16 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_token_y, Py_None); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2102, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_16); if (!(likely(PyUnicode_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_16))) __PYX_ERR(0, 2102, __pyx_L4_error)
+2103: params.get('auth_timeout'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2103, __pyx_L4_error) } __pyx_t_17 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_auth_timeout, Py_None); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2103, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_17);
+2104: params.get('tls_verify'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2104, __pyx_L4_error) } __pyx_t_18 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_tls_verify, Py_None); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2104, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_18);
+2105: params.get('tls_ca'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2105, __pyx_L4_error) } __pyx_t_19 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_tls_ca, Py_None); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2105, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_19);
+2106: params.get('tls_roots'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2106, __pyx_L4_error) } __pyx_t_20 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_tls_roots, Py_None); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 2106, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_20);
+2107: params.get('max_buf_size'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2107, __pyx_L4_error) } __pyx_t_21 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_max_buf_size, Py_None); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2107, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_21);
+2108: params.get('retry_timeout'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2108, __pyx_L4_error) } __pyx_t_22 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_retry_timeout, Py_None); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 2108, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_22);
+2109: params.get('request_min_throughput'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2109, __pyx_L4_error) } __pyx_t_23 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_request_min_throughput, Py_None); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 2109, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_23);
+2110: params.get('request_timeout'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2110, __pyx_L4_error) } __pyx_t_24 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_request_timeout, Py_None); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2110, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_24);
+2111: params.get('auto_flush'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2111, __pyx_L4_error) } __pyx_t_25 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_auto_flush, Py_None); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2111, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_25);
+2112: params.get('auto_flush_rows'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2112, __pyx_L4_error) } __pyx_t_26 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_auto_flush_rows, Py_None); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 2112, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_26);
+2113: params.get('auto_flush_bytes'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2113, __pyx_L4_error) } __pyx_t_27 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_auto_flush_bytes, Py_None); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 2113, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_27);
+2114: params.get('auto_flush_interval'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2114, __pyx_L4_error) } __pyx_t_28 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_auto_flush_interval, Py_None); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 2114, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_28);
+2115: params.get('init_buf_size'),
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2115, __pyx_L4_error) } __pyx_t_29 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_init_buf_size, Py_None); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 2115, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_29);
+2116: params.get('max_name_len'))
if (unlikely(__pyx_v_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 2116, __pyx_L4_error) } __pyx_t_30 = __Pyx_PyDict_GetItemDefault(__pyx_v_params, __pyx_n_u_max_name_len, Py_None); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 2116, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_30);
2117:
+2118: return sender
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_sender); __pyx_r = ((PyObject *)__pyx_v_sender); goto __pyx_L3_return; }
2119: finally:
+2120: qdb_pystr_buf_free(b)
/*finally:*/ { __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_32 = 0; __pyx_t_33 = 0; __pyx_t_34 = 0; __pyx_t_35 = 0; __pyx_t_36 = 0; __pyx_t_37 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0; __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0; __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_32, &__pyx_t_33, &__pyx_t_34) < 0)) __Pyx_ErrFetch(&__pyx_t_32, &__pyx_t_33, &__pyx_t_34); __Pyx_XGOTREF(__pyx_t_32); __Pyx_XGOTREF(__pyx_t_33); __Pyx_XGOTREF(__pyx_t_34); __Pyx_XGOTREF(__pyx_t_35); __Pyx_XGOTREF(__pyx_t_36); __Pyx_XGOTREF(__pyx_t_37); __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_31 = __pyx_filename; { qdb_pystr_buf_free(__pyx_v_b); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_35); __Pyx_XGIVEREF(__pyx_t_36); __Pyx_XGIVEREF(__pyx_t_37); __Pyx_ExceptionReset(__pyx_t_35, __pyx_t_36, __pyx_t_37); } __Pyx_XGIVEREF(__pyx_t_32); __Pyx_XGIVEREF(__pyx_t_33); __Pyx_XGIVEREF(__pyx_t_34); __Pyx_ErrRestore(__pyx_t_32, __pyx_t_33, __pyx_t_34); __pyx_t_32 = 0; __pyx_t_33 = 0; __pyx_t_34 = 0; __pyx_t_35 = 0; __pyx_t_36 = 0; __pyx_t_37 = 0; __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_31; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_37 = __pyx_r; __pyx_r = 0; qdb_pystr_buf_free(__pyx_v_b); __pyx_r = __pyx_t_37; __pyx_t_37 = 0; goto __pyx_L0; } }
2121:
+2122: @staticmethod
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_7from_env(CYTHON_UNUSED PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_6from_env, "\n Construct a sender from the ``QDB_CLIENT_CONF`` environment variable.\n\n The environment variable must be set to a valid\n :ref:`configuration string <sender_conf>`.\n\n The additional arguments are used to specify additional parameters\n which are not present in the configuration string.\n\n Note that any parameters already present in the configuration string\n cannot be overridden.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_7from_env = {"from_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_7from_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_6from_env}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_7from_env(CYTHON_UNUSED PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_bind_interface = 0; PyObject *__pyx_v_username = 0; PyObject *__pyx_v_password = 0; PyObject *__pyx_v_token = 0; PyObject *__pyx_v_token_x = 0; PyObject *__pyx_v_token_y = 0; PyObject *__pyx_v_auth_timeout = 0; PyObject *__pyx_v_tls_verify = 0; PyObject *__pyx_v_tls_ca = 0; PyObject *__pyx_v_tls_roots = 0; PyObject *__pyx_v_max_buf_size = 0; PyObject *__pyx_v_retry_timeout = 0; PyObject *__pyx_v_request_min_throughput = 0; PyObject *__pyx_v_request_timeout = 0; PyObject *__pyx_v_auto_flush = 0; PyObject *__pyx_v_auto_flush_rows = 0; PyObject *__pyx_v_auto_flush_bytes = 0; PyObject *__pyx_v_auto_flush_interval = 0; PyObject *__pyx_v_init_buf_size = 0; PyObject *__pyx_v_max_name_len = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_env (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bind_interface,&__pyx_n_s_username,&__pyx_n_s_password,&__pyx_n_s_token,&__pyx_n_s_token_x,&__pyx_n_s_token_y,&__pyx_n_s_auth_timeout,&__pyx_n_s_tls_verify,&__pyx_n_s_tls_ca,&__pyx_n_s_tls_roots,&__pyx_n_s_max_buf_size,&__pyx_n_s_retry_timeout,&__pyx_n_s_request_min_throughput,&__pyx_n_s_request_timeout,&__pyx_n_s_auto_flush,&__pyx_n_s_auto_flush_rows,&__pyx_n_s_auto_flush_bytes,&__pyx_n_s_auto_flush_interval,&__pyx_n_s_init_buf_size,&__pyx_n_s_max_name_len,0}; PyObject* values[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_6from_env(PyObject *__pyx_v_bind_interface, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_token, PyObject *__pyx_v_token_x, PyObject *__pyx_v_token_y, PyObject *__pyx_v_auth_timeout, PyObject *__pyx_v_tls_verify, PyObject *__pyx_v_tls_ca, PyObject *__pyx_v_tls_roots, PyObject *__pyx_v_max_buf_size, PyObject *__pyx_v_retry_timeout, PyObject *__pyx_v_request_min_throughput, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_auto_flush, PyObject *__pyx_v_auto_flush_rows, PyObject *__pyx_v_auto_flush_bytes, PyObject *__pyx_v_auto_flush_interval, PyObject *__pyx_v_init_buf_size, PyObject *__pyx_v_max_name_len) { PyObject *__pyx_v_conf_str = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ingress.Sender.from_env", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_conf_str); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__95 = PyTuple_Pack(21, __pyx_n_s_bind_interface, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_token, __pyx_n_s_token_x, __pyx_n_s_token_y, __pyx_n_s_auth_timeout, __pyx_n_s_tls_verify, __pyx_n_s_tls_ca, __pyx_n_s_tls_roots, __pyx_n_s_max_buf_size, __pyx_n_s_retry_timeout, __pyx_n_s_request_min_throughput, __pyx_n_s_request_timeout, __pyx_n_s_auto_flush, __pyx_n_s_auto_flush_rows, __pyx_n_s_auto_flush_bytes, __pyx_n_s_auto_flush_interval, __pyx_n_s_init_buf_size, __pyx_n_s_max_name_len, __pyx_n_s_conf_str); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__95); __Pyx_GIVEREF(__pyx_tuple__95); /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_7from_env, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_from_env, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_3, __pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_env, __pyx_t_3) < 0) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_env); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_from_env, __pyx_t_19) < 0) __PYX_ERR(0, 2122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(0, 0, 20, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_env, 2122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 2122, __pyx_L1_error)
2123: def from_env(
2124: *,
+2125: str bind_interface=None,
values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_bind_interface, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2126: str username=None,
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_username, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2127: str password=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_password, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2128: str token=None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2129: str token_x=None,
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token_x, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2130: str token_y=None,
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_token_y, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2131: object auth_timeout=None, # default: 15000 milliseconds
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auth_timeout, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2132: object tls_verify=None, # default: True
values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_verify, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2133: object tls_ca=None, # default: TlsCa.WebpkiRoots
values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_ca, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2134: object tls_roots=None,
values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_tls_roots, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2135: object max_buf_size=None, # 100 * 1024 * 1024 - 100MiB
values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_max_buf_size, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2136: object retry_timeout=None, # default: 10000 milliseconds
values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_retry_timeout, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2137: object request_min_throughput=None, # default: 100 * 1024 - 100KiB/s
values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_request_min_throughput, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2138: object request_timeout=None,
values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_request_timeout, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2139: object auto_flush=None, # Default True
values[14] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2140: object auto_flush_rows=None, # Default 75000 (HTTP) or 600 (TCP)
values[15] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_rows, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2141: object auto_flush_bytes=None, # Default off
values[16] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_bytes, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2142: object auto_flush_interval=None, # Default 1000 milliseconds
values[17] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_auto_flush_interval, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2143: object init_buf_size=None, # 64KiB
values[18] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_init_buf_size, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
+2144: object max_name_len=None): # 127
values[19] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); if (kw_args > 0 && likely(kw_args <= 20)) { Py_ssize_t index; for (index = 0; index < 20 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2122, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "from_env") < 0)) __PYX_ERR(0, 2122, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 0)) { goto __pyx_L5_argtuple_error; } else { } __pyx_v_bind_interface = ((PyObject*)values[0]); __pyx_v_username = ((PyObject*)values[1]); __pyx_v_password = ((PyObject*)values[2]); __pyx_v_token = ((PyObject*)values[3]); __pyx_v_token_x = ((PyObject*)values[4]); __pyx_v_token_y = ((PyObject*)values[5]); __pyx_v_auth_timeout = values[6]; __pyx_v_tls_verify = values[7]; __pyx_v_tls_ca = values[8]; __pyx_v_tls_roots = values[9]; __pyx_v_max_buf_size = values[10]; __pyx_v_retry_timeout = values[11]; __pyx_v_request_min_throughput = values[12]; __pyx_v_request_timeout = values[13]; __pyx_v_auto_flush = values[14]; __pyx_v_auto_flush_rows = values[15]; __pyx_v_auto_flush_bytes = values[16]; __pyx_v_auto_flush_interval = values[17]; __pyx_v_init_buf_size = values[18]; __pyx_v_max_name_len = values[19]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("from_env", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 2122, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.from_env", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bind_interface), (&PyUnicode_Type), 1, "bind_interface", 1))) __PYX_ERR(0, 2125, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_username), (&PyUnicode_Type), 1, "username", 1))) __PYX_ERR(0, 2126, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_password), (&PyUnicode_Type), 1, "password", 1))) __PYX_ERR(0, 2127, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token), (&PyUnicode_Type), 1, "token", 1))) __PYX_ERR(0, 2128, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_x), (&PyUnicode_Type), 1, "token_x", 1))) __PYX_ERR(0, 2129, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_token_y), (&PyUnicode_Type), 1, "token_y", 1))) __PYX_ERR(0, 2130, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_6from_env(__pyx_v_bind_interface, __pyx_v_username, __pyx_v_password, __pyx_v_token, __pyx_v_token_x, __pyx_v_token_y, __pyx_v_auth_timeout, __pyx_v_tls_verify, __pyx_v_tls_ca, __pyx_v_tls_roots, __pyx_v_max_buf_size, __pyx_v_retry_timeout, __pyx_v_request_min_throughput, __pyx_v_request_timeout, __pyx_v_auto_flush, __pyx_v_auto_flush_rows, __pyx_v_auto_flush_bytes, __pyx_v_auto_flush_interval, __pyx_v_init_buf_size, __pyx_v_max_name_len); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_max_name_len, Py_None) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
2145: """
2146: Construct a sender from the ``QDB_CLIENT_CONF`` environment variable.
2147:
2148: The environment variable must be set to a valid
2149: :ref:`configuration string <sender_conf>`.
2150:
2151: The additional arguments are used to specify additional parameters
2152: which are not present in the configuration string.
2153:
2154: Note that any parameters already present in the configuration string
2155: cannot be overridden.
2156: """
+2157: cdef str conf_str = os.environ.get('QDB_CLIENT_CONF')
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_n_u_QDB_CLIENT_CONF}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(0, 2157, __pyx_L1_error) __pyx_v_conf_str = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+2158: if conf_str is None:
__pyx_t_5 = (__pyx_v_conf_str == ((PyObject*)Py_None)); if (unlikely(__pyx_t_5)) { /* … */ }
+2159: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2160: IngressErrorCode.ConfigError,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ConfigError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_6, __pyx_kp_u_Environment_variable_QDB_CLIENT}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2159, __pyx_L1_error)
2161: 'Environment variable QDB_CLIENT_CONF is not set.')
+2162: return Sender.from_conf(
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7questdb_7ingress_Sender), __pyx_n_s_from_conf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_conf_str); __Pyx_GIVEREF(__pyx_v_conf_str); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_conf_str)) __PYX_ERR(0, 2162, __pyx_L1_error); /* … */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
2163: conf_str,
+2164: bind_interface=bind_interface,
__pyx_t_6 = __Pyx_PyDict_NewPresized(20); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bind_interface, __pyx_v_bind_interface) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2165: username=username,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_username, __pyx_v_username) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2166: password=password,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_password, __pyx_v_password) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2167: token=token,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_token, __pyx_v_token) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2168: token_x=token_x,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_token_x, __pyx_v_token_x) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2169: token_y=token_y,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_token_y, __pyx_v_token_y) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2170: auth_timeout=auth_timeout,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_auth_timeout, __pyx_v_auth_timeout) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2171: tls_verify=tls_verify,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tls_verify, __pyx_v_tls_verify) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2172: tls_ca=tls_ca,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tls_ca, __pyx_v_tls_ca) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2173: tls_roots=tls_roots,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tls_roots, __pyx_v_tls_roots) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2174: max_buf_size=max_buf_size,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_max_buf_size, __pyx_v_max_buf_size) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2175: retry_timeout=retry_timeout,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_retry_timeout, __pyx_v_retry_timeout) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2176: request_min_throughput=request_min_throughput,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_request_min_throughput, __pyx_v_request_min_throughput) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2177: request_timeout=request_timeout,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_request_timeout, __pyx_v_request_timeout) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2178: auto_flush=auto_flush,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_auto_flush, __pyx_v_auto_flush) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2179: auto_flush_rows=auto_flush_rows,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_auto_flush_rows, __pyx_v_auto_flush_rows) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2180: auto_flush_bytes=auto_flush_bytes,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_auto_flush_bytes, __pyx_v_auto_flush_bytes) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2181: auto_flush_interval=auto_flush_interval,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_auto_flush_interval, __pyx_v_auto_flush_interval) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2182: init_buf_size=init_buf_size,
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_init_buf_size, __pyx_v_init_buf_size) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
+2183: max_name_len=max_name_len)
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_max_name_len, __pyx_v_max_name_len) < 0) __PYX_ERR(0, 2164, __pyx_L1_error)
2184:
2185:
+2186: def new_buffer(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_9new_buffer(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_8new_buffer, "\n Make a new configured buffer.\n\n The buffer is set up with the configured `init_buf_size` and\n `max_name_len`.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_9new_buffer = {"new_buffer", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_9new_buffer, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_8new_buffer}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_9new_buffer(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_buffer (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("new_buffer", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "new_buffer", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_8new_buffer(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_8new_buffer(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.new_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_9new_buffer, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_new_buffer, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_new_buffer, __pyx_t_19) < 0) __PYX_ERR(0, 2186, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); /* … */ __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_new_buffer, 2186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 2186, __pyx_L1_error)
2187: """
2188: Make a new configured buffer.
2189:
2190: The buffer is set up with the configured `init_buf_size` and
2191: `max_name_len`.
2192: """
+2193: return Buffer(
__Pyx_XDECREF(__pyx_r); /* … */ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+2194: init_buf_size=self._init_buf_size,
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_buf_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_init_buf_size, __pyx_t_2) < 0) __PYX_ERR(0, 2194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+2195: max_name_len=self._max_name_len)
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_name_len, __pyx_t_2) < 0) __PYX_ERR(0, 2194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2196:
+2197: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13init_buf_size_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13init_buf_size_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_13init_buf_size___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_13init_buf_size___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.init_buf_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2198: def init_buf_size(self) -> int:
2199: """The initial capacity of the sender's internal buffer."""
+2200: return self._init_buf_size
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_buf_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
2201:
+2202: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_12max_name_len_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_12max_name_len_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_12max_name_len___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_12max_name_len___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.max_name_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2203: def max_name_len(self) -> int:
2204: """Maximum length of a table or column name."""
+2205: return self._max_name_len
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
2206:
+2207: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_10auto_flush_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_10auto_flush_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_10auto_flush___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_10auto_flush___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.auto_flush.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2208: def auto_flush(self) -> bint:
2209: """
2210: Auto-flushing is enabled.
2211:
2212: Consult the `.auto_flush_rows`, `.auto_flush_bytes` and
2213: `.auto_flush_interval` properties for the current active thresholds.
2214: """
+2215: return self._auto_flush_mode.enabled
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_auto_flush_mode.enabled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
2216:
+2217: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15auto_flush_rows_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15auto_flush_rows_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_15auto_flush_rows___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_15auto_flush_rows___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.auto_flush_rows.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2218: def auto_flush_rows(self) -> Optional[int]:
2219: """
2220: Row count threshold for the auto-flush logic, or None if disabled.
2221: """
+2222: if not self._auto_flush_mode.enabled:
__pyx_t_1 = (!__pyx_v_self->_auto_flush_mode.enabled); if (__pyx_t_1) { /* … */ }
+2223: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2224: if self._auto_flush_mode.row_count == -1:
__pyx_t_1 = (__pyx_v_self->_auto_flush_mode.row_count == -1L); if (__pyx_t_1) { /* … */ }
+2225: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2226: return self._auto_flush_mode.row_count
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_auto_flush_mode.row_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
2227:
+2228: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_16auto_flush_bytes_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_16auto_flush_bytes_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_16auto_flush_bytes___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_16auto_flush_bytes___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.auto_flush_bytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2229: def auto_flush_bytes(self) -> Optional[int]:
2230: """
2231: Byte-count threshold for the auto-flush logic, or None if disabled.
2232: """
+2233: if not self._auto_flush_mode.enabled:
__pyx_t_1 = (!__pyx_v_self->_auto_flush_mode.enabled); if (__pyx_t_1) { /* … */ }
+2234: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2235: if self._auto_flush_mode.byte_count == -1:
__pyx_t_1 = (__pyx_v_self->_auto_flush_mode.byte_count == -1L); if (__pyx_t_1) { /* … */ }
+2236: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2237: return self._auto_flush_mode.byte_count
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_auto_flush_mode.byte_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
2238:
+2239: @property
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19auto_flush_interval_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19auto_flush_interval_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_19auto_flush_interval___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_19auto_flush_interval___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Sender.auto_flush_interval.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2240: def auto_flush_interval(self) -> Optional[timedelta]:
2241: """
2242: Time interval threshold for the auto-flush logic, or None if disabled.
2243: """
+2244: if not self._auto_flush_mode.enabled:
__pyx_t_1 = (!__pyx_v_self->_auto_flush_mode.enabled); if (__pyx_t_1) { /* … */ }
+2245: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2246: if self._auto_flush_mode.interval == -1:
__pyx_t_1 = (__pyx_v_self->_auto_flush_mode.interval == -1L); if (__pyx_t_1) { /* … */ }
+2247: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+2248: return timedelta(milliseconds=self._auto_flush_mode.interval)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_auto_flush_mode.interval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_milliseconds, __pyx_t_3) < 0) __PYX_ERR(0, 2248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_8datetime_timedelta), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
2249:
+2250: def establish(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_11establish(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_10establish, "\n Prepare the sender for use.\n\n If using ILP/HTTP this will initialize the HTTP connection pool.\n\n If using ILP/TCP this will cause connection to the server and \n block until the connection is established.\n\n If the TCP connection is set up with authentication and/or TLS, this\n method will return only *after* the handshake(s) is/are complete.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_11establish = {"establish", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_11establish, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_10establish}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_11establish(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("establish (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("establish", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "establish", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_10establish(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_10establish(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { struct line_sender_error *__pyx_v_err; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.Sender.establish", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__98 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 2250, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__98); __Pyx_GIVEREF(__pyx_tuple__98); /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_11establish, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_establish, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_establish, __pyx_t_19) < 0) __PYX_ERR(0, 2250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_establish, 2250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 2250, __pyx_L1_error)
2251: """
2252: Prepare the sender for use.
2253:
2254: If using ILP/HTTP this will initialize the HTTP connection pool.
2255:
2256: If using ILP/TCP this will cause connection to the server and
2257: block until the connection is established.
2258:
2259: If the TCP connection is set up with authentication and/or TLS, this
2260: method will return only *after* the handshake(s) is/are complete.
2261: """
+2262: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+2263: if self._opts == NULL:
__pyx_t_1 = (__pyx_v_self->_opts == NULL); if (unlikely(__pyx_t_1)) { /* … */ }
+2264: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+2265: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_establish_can_t_be_called_after}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 2264, __pyx_L1_error)
2266: 'establish() can\'t be called after close().')
+2267: self._impl = line_sender_build(self._opts, &err)
__pyx_v_self->_impl = line_sender_build(__pyx_v_self->_opts, (&__pyx_v_err));
+2268: if self._impl == NULL:
__pyx_t_1 = (__pyx_v_self->_impl == NULL); if (unlikely(__pyx_t_1)) { /* … */ }
+2269: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 2269, __pyx_L1_error)
+2270: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+2271: self._opts = NULL
__pyx_v_self->_opts = NULL;
2272:
2273: # Request callbacks when rows are complete.
+2274: if self._buffer is not None:
__pyx_t_1 = (((PyObject *)__pyx_v_self->_buffer) != Py_None); if (__pyx_t_1) { /* … */ }
+2275: self._buffer._row_complete_sender = PyWeakref_NewRef(self, None)
__pyx_t_2 = PyWeakref_NewRef(((PyObject *)__pyx_v_self), Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_buffer->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_buffer->_row_complete_sender); __pyx_v_self->_buffer->_row_complete_sender = __pyx_t_2; __pyx_t_2 = 0;
2276:
+2277: self._last_flush_ms[0] = line_sender_now_micros() // 1000
(__pyx_v_self->_last_flush_ms[0]) = __Pyx_div_int64_t(line_sender_now_micros(), 0x3E8);
2278:
+2279: def __enter__(self) -> Sender:
/* Python wrapper */ static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pw_7questdb_7ingress_6Sender_13__enter__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_12__enter__, "Call :func:`Sender.establish` at the start of a ``with`` block."); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_13__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_13__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_12__enter__}; static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pw_7questdb_7ingress_6Sender_13__enter__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; struct __pyx_obj_7questdb_7ingress_Sender *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_12__enter__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pf_7questdb_7ingress_6Sender_12__enter__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { struct __pyx_obj_7questdb_7ingress_Sender *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Sender.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_return, __pyx_n_s_Sender) < 0) __PYX_ERR(0, 2279, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_13__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___enter, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_enter, __pyx_t_3) < 0) __PYX_ERR(0, 2279, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); /* … */ __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_enter, 2279, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 2279, __pyx_L1_error)
2280: """Call :func:`Sender.establish` at the start of a ``with`` block."""
+2281: self.establish()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_establish); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2282: return self
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0;
2283:
+2284: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15__str__(PyObject *__pyx_v_self); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_14__str__, "\n Inspect the contents of the internal buffer.\n\n The ``str`` value returned represents the unsent data.\n\n Also see :func:`Sender.__len__`.\n "); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Sender_14__str__; #endif static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15__str__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_14__str__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_14__str__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
2285: """
2286: Inspect the contents of the internal buffer.
2287:
2288: The ``str`` value returned represents the unsent data.
2289:
2290: Also see :func:`Sender.__len__`.
2291: """
+2292: return str(self._buffer)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_Unicode(((PyObject *)__pyx_v_self->_buffer)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
2293:
+2294: def __len__(self) -> int:
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_7ingress_6Sender_17__len__(PyObject *__pyx_v_self); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_16__len__, "\n Number of bytes of unsent data in the internal buffer.\n\n Equivalent (but cheaper) to ``len(str(sender))``.\n "); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Sender_16__len__; #endif static Py_ssize_t __pyx_pw_7questdb_7ingress_6Sender_17__len__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_16__len__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_7ingress_6Sender_16__len__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { Py_ssize_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
2295: """
2296: Number of bytes of unsent data in the internal buffer.
2297:
2298: Equivalent (but cheaper) to ``len(str(sender))``.
2299: """
+2300: return len(self._buffer)
__pyx_t_1 = ((PyObject *)__pyx_v_self->_buffer); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2300, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
2301:
+2302: def transaction(self, table_name: str):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19transaction(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_18transaction, "\n Start a :ref:`sender_transaction` block.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_19transaction = {"transaction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_19transaction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_18transaction}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19transaction(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_table_name = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("transaction (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_name)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2302, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "transaction") < 0)) __PYX_ERR(0, 2302, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_table_name = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("transaction", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2302, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 0, "table_name", 1))) __PYX_ERR(0, 2302, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_18transaction(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_table_name); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_18transaction(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_table_name) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__101 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_table_name); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 2302, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__101); __Pyx_GIVEREF(__pyx_tuple__101); /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_table_name, __pyx_n_s_str) < 0) __PYX_ERR(0, 2302, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_19transaction, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_transaction, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_transaction, __pyx_t_19) < 0) __PYX_ERR(0, 2302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_transaction, 2302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 2302, __pyx_L1_error)
2303: """
2304: Start a :ref:`sender_transaction` block.
2305: """
+2306: return SenderTransaction(self, table_name)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF((PyObject *)__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_v_self); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 2306, __pyx_L1_error); __Pyx_INCREF(__pyx_v_table_name); __Pyx_GIVEREF(__pyx_v_table_name); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_table_name)) __PYX_ERR(0, 2306, __pyx_L1_error); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_7ingress_SenderTransaction), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
2307:
+2308: def row(self,
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_21row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_20row, "\n Write a row to the internal buffer.\n\n This may be sent automatically depending on the ``auto_flush`` setting\n in the constructor.\n\n Refer to the :func:`Buffer.row` documentation for details on arguments.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_21row = {"row", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_21row, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_20row}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_21row(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,&__pyx_n_s_at,&__pyx_n_s_symbols,&__pyx_n_s_columns,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_20row(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_table_name, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Sender.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_19 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_table_name, __pyx_n_s_str) < 0) __PYX_ERR(0, 2308, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_symbols, __pyx_kp_s_Optional_Dict_str_str) < 0) __PYX_ERR(0, 2308, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_columns, __pyx_kp_s_Optional_Dict_str_Union_bool_int) < 0) __PYX_ERR(0, 2308, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_at, __pyx_kp_s_Union_TimestampNanos_datetime_Se) < 0) __PYX_ERR(0, 2308, __pyx_L1_error) __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_21row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_row, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__103)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_18, __pyx_t_19); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_18, __pyx_t_3); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_row, __pyx_t_18) < 0) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); /* … */ __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_row, 2308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(0, 2308, __pyx_L1_error)
2309: table_name: str,
2310: *,
+2311: symbols: Optional[Dict[str, str]]=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_symbols, Py_None) < 0) __PYX_ERR(0, 2308, __pyx_L1_error)
2312: columns: Optional[Dict[
2313: str,
+2314: Union[bool, int, float, str, TimestampMicros, datetime]]]=None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_name)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2308, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2308, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 2308, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 2)) { Py_ssize_t index; for (index = 2; index < 4 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2308, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "row") < 0)) __PYX_ERR(0, 2308, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("row", __pyx_n_s_at); __PYX_ERR(0, 2308, __pyx_L3_error) } __pyx_v_table_name = ((PyObject*)values[0]); __pyx_v_at = values[1]; __pyx_v_symbols = ((PyObject*)values[2]); __pyx_v_columns = ((PyObject*)values[3]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2308, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 0, "table_name", 1))) __PYX_ERR(0, 2309, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_symbols), (&PyDict_Type), 1, "symbols", 1))) __PYX_ERR(0, 2311, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyDict_Type), 1, "columns", 1))) __PYX_ERR(0, 2312, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_20row(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_table_name, __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_columns, Py_None) < 0) __PYX_ERR(0, 2308, __pyx_L1_error)
2315: at: Union[TimestampNanos, datetime, ServerTimestamp]):
2316: """
2317: Write a row to the internal buffer.
2318:
2319: This may be sent automatically depending on the ``auto_flush`` setting
2320: in the constructor.
2321:
2322: Refer to the :func:`Buffer.row` documentation for details on arguments.
2323: """
+2324: if self._in_txn:
if (unlikely(__pyx_v_self->_in_txn)) { /* … */ }
+2325: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2326: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_kp_u_Cannot_append_rows_explicitly_in}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2325, __pyx_L1_error)
2327: 'Cannot append rows explicitly inside a transaction')
+2328: if at is None:
__pyx_t_6 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_6)) { /* … */ }
+2329: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2330: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2329, __pyx_L1_error)
2331: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
2332: )
+2333: self._buffer.row(table_name, symbols=symbols, columns=columns, at=at)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_buffer), __pyx_n_s_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_table_name); __Pyx_GIVEREF(__pyx_v_table_name); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_table_name)) __PYX_ERR(0, 2333, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_symbols, __pyx_v_symbols) < 0) __PYX_ERR(0, 2333, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_columns, __pyx_v_columns) < 0) __PYX_ERR(0, 2333, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_at, __pyx_v_at) < 0) __PYX_ERR(0, 2333, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2334: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
2335:
+2336: def dataframe(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_23dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_22dataframe, "\n Write a Pandas DataFrame to the internal buffer.\n\n Example:\n\n .. code-block:: python\n\n import pandas as pd\n import questdb.ingress as qi\n\n df = pd.DataFrame({\n 'car': pd.Categorical(['Nic 42', 'Eddi', 'Nic 42', 'Eddi']),\n 'position': [1, 2, 1, 2],\n 'speed': [89.3, 98.2, 3, 4],\n 'lat_gforce': [0.1, -0.2, -0.6, 0.4],\n 'accelleration': [0.1, -0.2, 0.6, 4.4],\n 'tyre_pressure': [2.6, 2.5, 2.6, 2.5],\n 'ts': [\n pd.Timestamp('2022-08-09 13:56:00'),\n pd.Timestamp('2022-08-09 13:56:01'),\n pd.Timestamp('2022-08-09 13:56:02'),\n pd.Timestamp('2022-08-09 13:56:03')]})\n\n with qi.Sender.from_env() as sender:\n sender.dataframe(df, table_name='race_metrics', at='ts')\n\n This method builds on top of the :func:`Buffer.dataframe` method.\n See its documentation for details on arguments.\n\n Additionally, this method also supports auto-flushing the buffer\n as specified in the ``Sender``'s ``auto_flush`` constructor argument.\n Auto-flushing is implemented incrementally, meanting that when\n calling ``sender.dataframe(df)`` with a large ``df``, the sender may\n have sent some of the rows to the server already whist the rest of the\n rows are going to be sent at the next auto-flush or next explicit call\n to :func:`Sender.flush`.\n\n In case of data errors with auto-flushing enabled, some of the rows\n may have been transmitted to the server already.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_23dataframe = {"dataframe", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_23dataframe, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_22dataframe}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_23dataframe(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_table_name_col = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_at = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dataframe (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_at,&__pyx_n_s_table_name,&__pyx_n_s_table_name_col,&__pyx_n_s_symbols,0}; PyObject* values[5] = {0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_22dataframe(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_table_name, PyObject *__pyx_v_table_name_col, PyObject *__pyx_v_symbols, PyObject *__pyx_v_at) { struct __pyx_t_7questdb_7ingress_auto_flush_t __pyx_v_af; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Sender.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__104 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_df, __pyx_n_s_table_name, __pyx_n_s_table_name_col, __pyx_n_s_symbols, __pyx_n_s_at, __pyx_n_s_af); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 2336, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__104); __Pyx_GIVEREF(__pyx_tuple__104); /* … */ __pyx_t_18 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_table_name, __pyx_kp_s_Optional_str) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_table_name_col, __pyx_kp_s_Union_None_int_str) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_symbols, __pyx_kp_s_Union_str_bool_List_int_List_str) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_at, __pyx_kp_s_Union_ServerTimestamp_int_str_Ti) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_23dataframe, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_dataframe, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_19, __pyx_t_18); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_19, __pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_dataframe, __pyx_t_19) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_dataframe, 2336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 2336, __pyx_L1_error)
2337: self,
2338: df, # : pd.DataFrame
2339: *,
+2340: table_name: Optional[str] = None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); /* … */ if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_table_name, Py_None) < 0) __PYX_ERR(0, 2336, __pyx_L1_error)
+2341: table_name_col: Union[None, int, str] = None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_auto)); if (likely(__pyx_kwds)) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2336, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_at)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2336, __pyx_L3_error) else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 2336, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 3)) { Py_ssize_t index; for (index = 2; index < 5 && kw_args > 0; index++) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]); if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2336, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dataframe") < 0)) __PYX_ERR(0, 2336, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { __Pyx_RaiseKeywordRequired("dataframe", __pyx_n_s_at); __PYX_ERR(0, 2336, __pyx_L3_error) } __pyx_v_df = values[0]; __pyx_v_at = values[1]; __pyx_v_table_name = ((PyObject*)values[2]); __pyx_v_table_name_col = values[3]; __pyx_v_symbols = values[4]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("dataframe", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2336, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 2340, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_22dataframe(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_df, __pyx_v_table_name, __pyx_v_table_name_col, __pyx_v_symbols, __pyx_v_at); /* … */ if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_table_name_col, Py_None) < 0) __PYX_ERR(0, 2336, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_symbols, __pyx_n_u_auto) < 0) __PYX_ERR(0, 2336, __pyx_L1_error)
2342: symbols: Union[str, bool, List[int], List[str]] = 'auto',
2343: at: Union[ServerTimestamp, int, str, TimestampNanos, datetime]):
2344: """
2345: Write a Pandas DataFrame to the internal buffer.
2346:
2347: Example:
2348:
2349: .. code-block:: python
2350:
2351: import pandas as pd
2352: import questdb.ingress as qi
2353:
2354: df = pd.DataFrame({
2355: 'car': pd.Categorical(['Nic 42', 'Eddi', 'Nic 42', 'Eddi']),
2356: 'position': [1, 2, 1, 2],
2357: 'speed': [89.3, 98.2, 3, 4],
2358: 'lat_gforce': [0.1, -0.2, -0.6, 0.4],
2359: 'accelleration': [0.1, -0.2, 0.6, 4.4],
2360: 'tyre_pressure': [2.6, 2.5, 2.6, 2.5],
2361: 'ts': [
2362: pd.Timestamp('2022-08-09 13:56:00'),
2363: pd.Timestamp('2022-08-09 13:56:01'),
2364: pd.Timestamp('2022-08-09 13:56:02'),
2365: pd.Timestamp('2022-08-09 13:56:03')]})
2366:
2367: with qi.Sender.from_env() as sender:
2368: sender.dataframe(df, table_name='race_metrics', at='ts')
2369:
2370: This method builds on top of the :func:`Buffer.dataframe` method.
2371: See its documentation for details on arguments.
2372:
2373: Additionally, this method also supports auto-flushing the buffer
2374: as specified in the ``Sender``'s ``auto_flush`` constructor argument.
2375: Auto-flushing is implemented incrementally, meanting that when
2376: calling ``sender.dataframe(df)`` with a large ``df``, the sender may
2377: have sent some of the rows to the server already whist the rest of the
2378: rows are going to be sent at the next auto-flush or next explicit call
2379: to :func:`Sender.flush`.
2380:
2381: In case of data errors with auto-flushing enabled, some of the rows
2382: may have been transmitted to the server already.
2383: """
+2384: cdef auto_flush_t af = auto_flush_blank()
__pyx_v_af = __pyx_f_7questdb_7ingress_auto_flush_blank();
+2385: if self._in_txn:
if (unlikely(__pyx_v_self->_in_txn)) { /* … */ }
+2386: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2387: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_kp_u_Cannot_append_rows_explicitly_in}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2386, __pyx_L1_error)
2388: 'Cannot append rows explicitly inside a transaction')
+2389: if at is None:
__pyx_t_6 = (__pyx_v_at == Py_None); if (unlikely(__pyx_t_6)) { /* … */ }
+2390: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2391: IngressErrorCode.InvalidTimestamp,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_kp_u_at_must_be_of_type_TimestampNan}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2390, __pyx_L1_error)
2392: "`at` must be of type TimestampNanos, datetime, or ServerTimestamp"
2393: )
+2394: if self._auto_flush_mode.enabled:
if (__pyx_v_self->_auto_flush_mode.enabled) { /* … */ }
+2395: af.sender = self._impl
__pyx_t_7 = __pyx_v_self->_impl; __pyx_v_af.sender = __pyx_t_7;
+2396: af.mode = self._auto_flush_mode
__pyx_t_8 = __pyx_v_self->_auto_flush_mode; __pyx_v_af.mode = __pyx_t_8;
+2397: af.last_flush_ms = self._last_flush_ms
__pyx_t_9 = __pyx_v_self->_last_flush_ms; __pyx_v_af.last_flush_ms = __pyx_t_9;
+2398: _dataframe(
__pyx_t_10 = __pyx_f_7questdb_7ingress__dataframe(__pyx_v_af, __pyx_v_self->_buffer->_impl, __pyx_v_self->_buffer->_b, __pyx_v_df, __pyx_v_table_name, __pyx_v_table_name_col, __pyx_v_symbols, __pyx_v_at); if (unlikely(__pyx_t_10 == ((__pyx_t_7questdb_7ingress_void_int)-1))) __PYX_ERR(0, 2398, __pyx_L1_error)
2399: af,
2400: self._buffer._impl,
2401: self._buffer._b,
2402: df,
2403: table_name,
2404: table_name_col,
2405: symbols,
2406: at)
+2407: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
2408:
+2409: cpdef flush(
static PyObject *__pyx_pw_7questdb_7ingress_6Sender_25flush(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyObject *__pyx_f_7questdb_7ingress_6Sender_flush(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_flush *__pyx_optional_args) { /* … */ /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_7questdb_7ingress_6Sender_25flush)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_transactional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[4] = {__pyx_t_6, ((PyObject *)__pyx_v_buffer), __pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 3+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_25flush(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_24flush, "\n If called with no arguments, immediately flushes the internal buffer.\n\n Alternatively you can flush a buffer that was constructed explicitly\n by passing ``buffer``.\n\n The buffer will be cleared by default, unless ``clear`` is set to\n ``False``.\n\n This method does nothing if the provided or internal buffer is empty.\n\n :param buffer: The buffer to flush. If ``None``, the internal buffer\n is flushed.\n\n :param clear: If ``True``, the flushed buffer is cleared (default).\n If ``False``, the flushed buffer is left in the internal buffer.\n Note that ``clear=False`` is only supported if ``buffer`` is also\n specified.\n\n :param transactional: If ``True`` ensures that the flushed buffer\n contains row for a single table, ensuring all data can be written\n transactionally. This feature requires ILP/HTTP and is not available\n when connecting over TCP. *Default: False.*\n\n The Python GIL is released during the network IO operation.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_25flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_25flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_24flush}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_25flush(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer = 0; int __pyx_v_clear; int __pyx_v_transactional; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_clear,&__pyx_n_s_transactional,0}; PyObject* values[3] = {0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_24flush(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer, int __pyx_v_clear, int __pyx_v_transactional) { PyObject *__pyx_r = NULL; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 3; __pyx_t_2.buffer = __pyx_v_buffer; __pyx_t_2.clear = __pyx_v_clear; __pyx_t_2.transactional = __pyx_v_transactional; __pyx_t_1 = __pyx_vtabptr_7questdb_7ingress_Sender->flush(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__106 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_buffer, __pyx_n_s_clear, __pyx_n_s_transactional); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__106); __Pyx_GIVEREF(__pyx_tuple__106); __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_flush, 2409, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 2409, __pyx_L1_error) /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_25flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_flush, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_19, __pyx_tuple__108); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_flush, __pyx_t_19) < 0) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_tuple__108 = PyTuple_Pack(3, Py_None, Py_True, Py_False); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 2409, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__108); __Pyx_GIVEREF(__pyx_tuple__108); /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_flush { int __pyx_n; struct __pyx_obj_7questdb_7ingress_Buffer *buffer; int clear; int transactional; };
2410: self,
+2411: Buffer buffer=None,
struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None); /* … */ values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2409, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_clear); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2409, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_transactional); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2409, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "flush") < 0)) __PYX_ERR(0, 2409, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)values[0]); if (values[1]) { __pyx_v_clear = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_clear == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error) } else {
+2412: bint clear=True,
int __pyx_v_clear = ((int)1); /* … */ __pyx_v_clear = ((int)1); } if (values[2]) { __pyx_v_transactional = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_transactional == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2413, __pyx_L3_error) } else {
+2413: bint transactional=False):
int __pyx_v_transactional = ((int)0); struct line_sender *__pyx_v_sender; struct line_sender_error *__pyx_v_err; struct line_sender_buffer *__pyx_v_c_buf; PyThreadState *__pyx_v_gs; int __pyx_v_ok; PyObject *__pyx_r = NULL; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_buffer = __pyx_optional_args->buffer; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_clear = __pyx_optional_args->clear; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_transactional = __pyx_optional_args->transactional; } } } } /* … */ __pyx_v_transactional = ((int)0); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("flush", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 2409, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_7questdb_7ingress_Buffer, 1, "buffer", 0))) __PYX_ERR(0, 2411, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_24flush(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_buffer, __pyx_v_clear, __pyx_v_transactional);
2414: """
2415: If called with no arguments, immediately flushes the internal buffer.
2416:
2417: Alternatively you can flush a buffer that was constructed explicitly
2418: by passing ``buffer``.
2419:
2420: The buffer will be cleared by default, unless ``clear`` is set to
2421: ``False``.
2422:
2423: This method does nothing if the provided or internal buffer is empty.
2424:
2425: :param buffer: The buffer to flush. If ``None``, the internal buffer
2426: is flushed.
2427:
2428: :param clear: If ``True``, the flushed buffer is cleared (default).
2429: If ``False``, the flushed buffer is left in the internal buffer.
2430: Note that ``clear=False`` is only supported if ``buffer`` is also
2431: specified.
2432:
2433: :param transactional: If ``True`` ensures that the flushed buffer
2434: contains row for a single table, ensuring all data can be written
2435: transactionally. This feature requires ILP/HTTP and is not available
2436: when connecting over TCP. *Default: False.*
2437:
2438: The Python GIL is released during the network IO operation.
2439: """
+2440: cdef line_sender* sender = self._impl
__pyx_t_8 = __pyx_v_self->_impl; __pyx_v_sender = __pyx_t_8;
+2441: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+2442: cdef line_sender_buffer* c_buf = NULL
__pyx_v_c_buf = NULL;
+2443: cdef PyThreadState* gs = NULL # GIL state. NULL means we have the GIL.
__pyx_v_gs = NULL;
+2444: cdef bint ok = False
__pyx_v_ok = 0;
2445:
+2446: if self._in_txn:
if (unlikely(__pyx_v_self->_in_txn)) { /* … */ }
+2447: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2448: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_4, __pyx_kp_u_Cannot_flush_explicitly_inside_a}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2447, __pyx_L1_error)
2449: 'Cannot flush explicitly inside a transaction')
2450:
+2451: if buffer is None and not clear:
__pyx_t_10 = (((PyObject *)__pyx_v_buffer) == Py_None); if (__pyx_t_10) { } else { __pyx_t_9 = __pyx_t_10; goto __pyx_L5_bool_binop_done; } __pyx_t_10 = (!__pyx_v_clear); __pyx_t_9 = __pyx_t_10; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_9)) { /* … */ }
+2452: raise ValueError('The internal buffer must always be cleared.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2452, __pyx_L1_error) /* … */ __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_The_internal_buffer_must_always); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 2452, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39);
2453:
+2454: if sender == NULL:
__pyx_t_9 = (__pyx_v_sender == NULL); if (unlikely(__pyx_t_9)) { /* … */ }
+2455: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+2456: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_flush_can_t_be_called_Not_connec}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2455, __pyx_L1_error)
2457: 'flush() can\'t be called: Not connected.')
+2458: if buffer is not None:
__pyx_t_9 = (((PyObject *)__pyx_v_buffer) != Py_None); if (__pyx_t_9) { /* … */ goto __pyx_L8; }
+2459: c_buf = buffer._impl
__pyx_t_11 = __pyx_v_buffer->_impl; __pyx_v_c_buf = __pyx_t_11;
2460: else:
+2461: c_buf = self._buffer._impl
/*else*/ { __pyx_t_11 = __pyx_v_self->_buffer->_impl; __pyx_v_c_buf = __pyx_t_11; } __pyx_L8:;
+2462: if line_sender_buffer_size(c_buf) == 0:
__pyx_t_9 = (line_sender_buffer_size(__pyx_v_c_buf) == 0); if (__pyx_t_9) { /* … */ }
+2463: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
2464:
2465: # We might be blocking on IO, so temporarily release the GIL.
+2466: _ensure_doesnt_have_gil(&gs)
__pyx_t_9 = __pyx_f_7questdb_7ingress__ensure_doesnt_have_gil((&__pyx_v_gs)); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2466, __pyx_L1_error)
+2467: if transactional:
if (__pyx_v_transactional) { /* … */ goto __pyx_L10; }
+2468: ok = line_sender_flush_and_keep_with_flags(
__pyx_v_ok = line_sender_flush_and_keep_with_flags(__pyx_v_sender, __pyx_v_c_buf, __pyx_v_transactional, (&__pyx_v_err));
2469: sender,
2470: c_buf,
2471: transactional,
2472: &err)
+2473: if ok and clear:
if (__pyx_v_ok) { } else { __pyx_t_9 = __pyx_v_ok; goto __pyx_L12_bool_binop_done; } __pyx_t_9 = __pyx_v_clear; __pyx_L12_bool_binop_done:; if (__pyx_t_9) { /* … */ }
+2474: line_sender_buffer_clear(c_buf)
line_sender_buffer_clear(__pyx_v_c_buf);
+2475: elif clear:
if (__pyx_v_clear) { /* … */ goto __pyx_L10; }
+2476: ok = line_sender_flush(sender, c_buf, &err)
__pyx_v_ok = line_sender_flush(__pyx_v_sender, __pyx_v_c_buf, (&__pyx_v_err));
2477: else:
+2478: ok = line_sender_flush_and_keep(sender, c_buf, &err)
/*else*/ { __pyx_v_ok = line_sender_flush_and_keep(__pyx_v_sender, __pyx_v_c_buf, (&__pyx_v_err)); } __pyx_L10:;
+2479: if ok and c_buf == self._buffer._impl:
if (__pyx_v_ok) { } else { __pyx_t_9 = __pyx_v_ok; goto __pyx_L15_bool_binop_done; } __pyx_t_10 = (__pyx_v_c_buf == __pyx_v_self->_buffer->_impl); __pyx_t_9 = __pyx_t_10; __pyx_L15_bool_binop_done:; if (__pyx_t_9) { /* … */ }
+2480: self._last_flush_ms[0] = line_sender_now_micros() // 1000
(__pyx_v_self->_last_flush_ms[0]) = __Pyx_div_int64_t(line_sender_now_micros(), 0x3E8);
+2481: _ensure_has_gil(&gs)
__pyx_f_7questdb_7ingress__ensure_has_gil((&__pyx_v_gs)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2481, __pyx_L1_error)
+2482: if not ok:
__pyx_t_9 = (!__pyx_v_ok); if (__pyx_t_9) { /* … */ }
+2483: if c_buf == self._buffer._impl:
__pyx_t_9 = (__pyx_v_c_buf == __pyx_v_self->_buffer->_impl); if (__pyx_t_9) { /* … */ }
2484: # Prevent a follow-up call to `.close(flush=True)` (as is
2485: # usually called from `__exit__`) to raise after the sender
2486: # entered an error state following a failed call to `.flush()`.
2487: # Note: In this case `clear` is always `True`.
+2488: line_sender_buffer_clear(c_buf)
line_sender_buffer_clear(__pyx_v_c_buf);
+2489: if _is_tcp_protocol(self._c_protocol):
__pyx_t_9 = __pyx_f_7questdb_7ingress__is_tcp_protocol(__pyx_v_self->_c_protocol); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2489, __pyx_L1_error) if (unlikely(__pyx_t_9)) { /* … */ }
2490: # Provide further context pointing to the logs.
+2491: raise c_err_to_py_fmt(err, _FLUSH_FMT)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FLUSH_FMT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(0, 2491, __pyx_L1_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py_fmt(__pyx_v_err, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 2491, __pyx_L1_error)
2492: else:
+2493: raise c_err_to_py(err)
/*else*/ { __pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 2493, __pyx_L1_error) }
2494:
+2495: cdef _close(self):
static PyObject *__pyx_f_7questdb_7ingress_6Sender__close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+2496: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF((PyObject *)__pyx_v_self->_buffer); __Pyx_DECREF((PyObject *)__pyx_v_self->_buffer); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None);
+2497: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+2498: self._opts = NULL
__pyx_v_self->_opts = NULL;
+2499: line_sender_close(self._impl)
line_sender_close(__pyx_v_self->_impl);
+2500: self._impl = NULL
__pyx_v_self->_impl = NULL;
2501:
+2502: cpdef close(self, bint flush=True):
static PyObject *__pyx_pw_7questdb_7ingress_6Sender_27close(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyObject *__pyx_f_7questdb_7ingress_6Sender_close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_close *__pyx_optional_args) { int __pyx_v_flush = ((int)1); PyObject *__pyx_r = NULL; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_flush = __pyx_optional_args->flush; } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_7questdb_7ingress_6Sender_27close)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_flush); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_27close(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_26close, "\n Disconnect.\n\n This method is idempotent and can be called repeatedly.\n\n Once a sender is closed, it can't be re-used.\n\n :param bool flush: If ``True``, flush the internal buffer before closing.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_27close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_27close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_26close}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_27close(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_flush; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flush,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flush); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2502, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "close") < 0)) __PYX_ERR(0, 2502, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } if (values[0]) { __pyx_v_flush = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flush == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2502, __pyx_L3_error) } else { __pyx_v_flush = ((int)1); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2502, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_26close(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_flush); /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_26close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_v_flush) { PyObject *__pyx_r = NULL; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.flush = __pyx_v_flush; __pyx_t_1 = __pyx_vtabptr_7questdb_7ingress_Sender->close(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__109 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_flush); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__109); __Pyx_GIVEREF(__pyx_tuple__109); __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_close, 2502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(0, 2502, __pyx_L1_error) /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_27close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_close, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__110)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_19, __pyx_tuple__111); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_close, __pyx_t_19) < 0) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_tuple__111 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 2502, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__111); __Pyx_GIVEREF(__pyx_tuple__111); /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_close { int __pyx_n; int flush; };
2503: """
2504: Disconnect.
2505:
2506: This method is idempotent and can be called repeatedly.
2507:
2508: Once a sender is closed, it can't be re-used.
2509:
2510: :param bool flush: If ``True``, flush the internal buffer before closing.
2511: """
+2512: try:
/*try:*/ {
+2513: if (flush and (self._impl != NULL) and
if (__pyx_v_flush) { } else { __pyx_t_7 = __pyx_v_flush; goto __pyx_L7_bool_binop_done; } __pyx_t_8 = (__pyx_v_self->_impl != NULL); if (__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L7_bool_binop_done; } /* … */ if (__pyx_t_7) { /* … */ } }
+2514: (not line_sender_must_close(self._impl))):
__pyx_t_8 = (!line_sender_must_close(__pyx_v_self->_impl)); __pyx_t_7 = __pyx_t_8; __pyx_L7_bool_binop_done:;
+2515: self.flush(None, True)
__pyx_t_9.__pyx_n = 2; __pyx_t_9.buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None); __pyx_t_9.clear = 1; __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->flush(__pyx_v_self, 0, &__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2515, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2516: finally:
+2517: self._close()
/*finally:*/ { /*normal exit:*/{ __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2517, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L1_error; __pyx_L11_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; goto __pyx_L1_error; } __pyx_L5:; }
2518:
+2519: def __exit__(self, exc_type, _exc_val, _exc_tb):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_29__exit__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7questdb_7ingress_6Sender_28__exit__, "\n Flush pending and disconnect at the end of a ``with`` block.\n\n If the ``with`` block raises an exception, any pending data will\n *NOT* be flushed.\n\n This is implemented by calling :func:`Sender.close`.\n "); static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_29__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_29__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_28__exit__}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_29__exit__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_exc_type = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_val = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_tb = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0}; PyObject* values[3] = {0,0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2519, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_val)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2519, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 2519, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_tb)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2519, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 2519, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(0, 2519, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } __pyx_v_exc_type = values[0]; __pyx_v__exc_val = values[1]; __pyx_v__exc_tb = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 2519, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("questdb.ingress.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_28__exit__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_exc_type, __pyx_v__exc_val, __pyx_v__exc_tb); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_28__exit__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v__exc_val, CYTHON_UNUSED PyObject *__pyx_v__exc_tb) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__112 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_val, __pyx_n_s_exc_tb); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 2519, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__112); __Pyx_GIVEREF(__pyx_tuple__112); /* … */ __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_29__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___exit, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7questdb_7ingress_Sender, __pyx_n_s_exit, __pyx_t_19) < 0) __PYX_ERR(0, 2519, __pyx_L1_error) __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_exit, 2519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 2519, __pyx_L1_error)
2520: """
2521: Flush pending and disconnect at the end of a ``with`` block.
2522:
2523: If the ``with`` block raises an exception, any pending data will
2524: *NOT* be flushed.
2525:
2526: This is implemented by calling :func:`Sender.close`.
2527: """
+2528: self.close(not exc_type)
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc_type); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2528, __pyx_L1_error) __pyx_t_3.__pyx_n = 1; __pyx_t_3.flush = (!__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2529:
+2530: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_7ingress_6Sender_31__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_7ingress_6Sender_31__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_7questdb_7ingress_6Sender_30__dealloc__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_7ingress_6Sender_30__dealloc__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("questdb.ingress.Sender.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+2531: self._close()
__pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2532: free(self._last_flush_ms)
free(__pyx_v_self->_last_flush_ms);
2533: