lidavidm commented on code in PR #3821:
URL: https://github.com/apache/arrow-adbc/pull/3821#discussion_r2639004339


##########
c/driver/postgresql/validation/queries/ingest/decimal.toml:
##########
@@ -0,0 +1,15 @@
+# Copyright (c) 2025 ADBC Drivers Contributors
+#
+# Licensed 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.

Review Comment:
   Contributions to this repo should use the license header for Apache projects



##########
c/driver/postgresql/validation/tests/test_connection.py:
##########
@@ -0,0 +1,73 @@
+# 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.
+
+import re
+import typing
+
+from adbc_drivers_validation import model
+from adbc_drivers_validation.tests.connection import (
+    TestConnection as BaseTestConnection,
+)
+from adbc_drivers_validation.tests.connection import (
+    generate_tests,
+)
+
+import adbc_driver_manager.dbapi
+
+from . import postgresql
+
+
+class TestConnection(BaseTestConnection):
+    """PostgreSQL-specific connection tests with overrides."""
+
+    def test_get_info(
+        self,
+        driver: model.DriverQuirks,
+        conn: adbc_driver_manager.dbapi.Connection,
+        record_property: typing.Callable[[str, typing.Any], None],
+    ) -> None:
+        """Override to accept (unknown) as valid driver version."""
+        info = conn.adbc_get_info()
+        driver_version = info.get("driver_version")
+        # PostgreSQL driver returns "(unknown)" instead of "unknown"
+        assert (
+            driver_version.startswith("v")
+            or driver_version == "unknown"
+            or driver_version == "unknown-dirty"
+            or driver_version == "(unknown)"
+        )
+        record_property("driver_version", driver_version)
+        assert info.get("driver_name") == driver.driver_name
+        assert info.get("vendor_name") == driver.vendor_name
+        vendor_version = info.get("vendor_version", "")
+        if isinstance(driver.vendor_version, re.Pattern):
+            assert driver.vendor_version.match(
+                vendor_version
+            ), f"{vendor_version!r} does not match {driver.vendor_version!r}"
+        else:
+            assert vendor_version == driver.vendor_version
+
+        # PostgreSQL returns arrow version without 'v' prefix
+        arrow_version = info.get("driver_arrow_version")
+        assert arrow_version.startswith("v") or arrow_version[0].isdigit()

Review Comment:
   For here, maybe fix the driver itself?



##########
c/driver/postgresql/validation/tests/test_statement.py:
##########
@@ -0,0 +1,93 @@
+# 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.
+
+from adbc_drivers_validation import model
+from adbc_drivers_validation.tests.statement import TestStatement as 
BaseTestStatement
+from adbc_drivers_validation.tests.statement import (
+    generate_tests,
+)
+
+import adbc_driver_manager
+
+from . import postgresql
+
+
+class TestStatement(BaseTestStatement):
+    """PostgreSQL-specific statement tests with overrides."""
+
+    def test_rows_affected(
+        self,
+        driver: model.DriverQuirks,
+        conn: adbc_driver_manager.dbapi.Connection,
+    ) -> None:
+        """Override to accept -1 for CREATE TABLE"""
+        table_name = "test_rows_affected"
+        with conn.cursor() as cursor:
+            cursor.adbc_statement.set_sql_query(
+                driver.drop_table(table_name="test_rows_affected")
+            )
+            try:
+                cursor.adbc_statement.execute_update()
+            except adbc_driver_manager.Error as e:
+                if not driver.is_table_not_found(table_name=table_name, 
error=e):
+                    raise
+
+            cursor.adbc_statement.set_sql_query(f"CREATE TABLE {table_name} 
(id INT)")
+            rows_affected = cursor.adbc_statement.execute_update()
+
+            # PostgreSQL returns -1 for CREATE TABLE
+            assert rows_affected == -1

Review Comment:
   If multiple vendors do this, we should probably add a flag to the test 
itself instead of requiring overriding this test every time



##########
c/driver/postgresql/validation/tests/test_connection.py:
##########
@@ -0,0 +1,73 @@
+# 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.
+
+import re
+import typing
+
+from adbc_drivers_validation import model
+from adbc_drivers_validation.tests.connection import (
+    TestConnection as BaseTestConnection,
+)
+from adbc_drivers_validation.tests.connection import (
+    generate_tests,
+)
+
+import adbc_driver_manager.dbapi
+
+from . import postgresql
+
+
+class TestConnection(BaseTestConnection):
+    """PostgreSQL-specific connection tests with overrides."""
+
+    def test_get_info(
+        self,
+        driver: model.DriverQuirks,
+        conn: adbc_driver_manager.dbapi.Connection,
+        record_property: typing.Callable[[str, typing.Any], None],
+    ) -> None:
+        """Override to accept (unknown) as valid driver version."""
+        info = conn.adbc_get_info()
+        driver_version = info.get("driver_version")
+        # PostgreSQL driver returns "(unknown)" instead of "unknown"

Review Comment:
   We can fix upstream instead of overriding this



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to