You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "isapego (via GitHub)" <gi...@apache.org> on 2024/07/11 14:11:11 UTC
[PR] IGNITE-22353 Basic Python DB API Driver [ignite-3]
isapego opened a new pull request, #4075:
URL: https://github.com/apache/ignite-3/pull/4075
https://issues.apache.org/jira/browse/IGNITE-22353
Implemented:
- Basic project layout;
- Tests stub;
- Integration with C++ project;
- Connection to a cluster (re-used ODBC code);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22353 Basic Python DB API Driver [ignite-3]
Posted by "isapego (via GitHub)" <gi...@apache.org>.
isapego commented on code in PR #4075:
URL: https://github.com/apache/ignite-3/pull/4075#discussion_r1674678211
##########
modules/platforms/python/cpp_module/py_connection.cpp:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/odbc/sql_environment.h>
+#include <ignite/odbc/sql_connection.h>
+
+#include <ignite/common/detail/config.h>
+
+#include "module.h"
+#include "py_connection.h"
+
+#include <Python.h>
+
+int py_connection_init(py_connection *self, PyObject *args, PyObject *kwds)
+{
+ UNUSED_VALUE args;
+ UNUSED_VALUE kwds;
+
+ self->m_env = nullptr;
+ self->m_conn = nullptr;
+
+ return 0;
+}
+
+void py_connection_dealloc(py_connection *self)
+{
+ delete self->m_conn;
+ delete self->m_env;
+
+ self->m_conn = nullptr;
+ self->m_env = nullptr;
+
+ Py_TYPE(self)->tp_free(self);
+}
+
+static PyObject* py_connection_close(py_connection* self, PyObject*)
+{
+ if (self->m_conn) {
+ self->m_conn->release();
+ if (!check_errors(*self->m_conn))
+ return nullptr;
Review Comment:
No, in this case neither `self->m_conn`, nor `self->m_env` are deleted until the connection is released. If there is an error during connection close, it probably means, connection was already closed with fail anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22353 Basic Python DB API Driver [ignite-3]
Posted by "isapego (via GitHub)" <gi...@apache.org>.
isapego commented on code in PR #4075:
URL: https://github.com/apache/ignite-3/pull/4075#discussion_r1674678211
##########
modules/platforms/python/cpp_module/py_connection.cpp:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/odbc/sql_environment.h>
+#include <ignite/odbc/sql_connection.h>
+
+#include <ignite/common/detail/config.h>
+
+#include "module.h"
+#include "py_connection.h"
+
+#include <Python.h>
+
+int py_connection_init(py_connection *self, PyObject *args, PyObject *kwds)
+{
+ UNUSED_VALUE args;
+ UNUSED_VALUE kwds;
+
+ self->m_env = nullptr;
+ self->m_conn = nullptr;
+
+ return 0;
+}
+
+void py_connection_dealloc(py_connection *self)
+{
+ delete self->m_conn;
+ delete self->m_env;
+
+ self->m_conn = nullptr;
+ self->m_env = nullptr;
+
+ Py_TYPE(self)->tp_free(self);
+}
+
+static PyObject* py_connection_close(py_connection* self, PyObject*)
+{
+ if (self->m_conn) {
+ self->m_conn->release();
+ if (!check_errors(*self->m_conn))
+ return nullptr;
Review Comment:
No, in this case neither `self->m_conn`, nor `self->m_env` are deleted until the connection is released.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22353 Basic Python DB API Driver [ignite-3]
Posted by "isapego (via GitHub)" <gi...@apache.org>.
isapego merged PR #4075:
URL: https://github.com/apache/ignite-3/pull/4075
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22353 Basic Python DB API Driver [ignite-3]
Posted by "arcolight (via GitHub)" <gi...@apache.org>.
arcolight commented on code in PR #4075:
URL: https://github.com/apache/ignite-3/pull/4075#discussion_r1674244144
##########
modules/platforms/python/cpp_module/py_connection.cpp:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/odbc/sql_environment.h>
+#include <ignite/odbc/sql_connection.h>
+
+#include <ignite/common/detail/config.h>
+
+#include "module.h"
+#include "py_connection.h"
+
+#include <Python.h>
+
+int py_connection_init(py_connection *self, PyObject *args, PyObject *kwds)
+{
+ UNUSED_VALUE args;
+ UNUSED_VALUE kwds;
+
+ self->m_env = nullptr;
+ self->m_conn = nullptr;
+
+ return 0;
+}
+
+void py_connection_dealloc(py_connection *self)
+{
+ delete self->m_conn;
+ delete self->m_env;
+
+ self->m_conn = nullptr;
+ self->m_env = nullptr;
+
+ Py_TYPE(self)->tp_free(self);
+}
+
+static PyObject* py_connection_close(py_connection* self, PyObject*)
+{
+ if (self->m_conn) {
+ self->m_conn->release();
+ if (!check_errors(*self->m_conn))
+ return nullptr;
Review Comment:
Should we delete `self->m_env` in this case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org