Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sql): Add JSON support #3972

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ztefanie
Copy link
Contributor

@ztefanie ztefanie commented Feb 7, 2025

Description

Added JSON parsing for string columns.
Added Uni Tests for all sql specific json columns

Related issues

closes #3895

Checklist

  • PR has a milestone or the no milestone label.

@ztefanie ztefanie added this to the 8.8.0-alpha2 milestone Feb 7, 2025
@ztefanie ztefanie requested a review from a team as a code owner February 7, 2025 11:35
});
}

private static boolean isPotentiallyJsonColumn(int columnType, Object value) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'value' is never used.

Copilot Autofix AI 3 days ago

To fix the problem, we need to remove the unused parameter value from the method isPotentiallyJsonColumn. This involves updating the method signature to exclude the value parameter and ensuring that any calls to this method are updated accordingly. Since the provided code does not show any calls to this method, we will assume that the method is only used internally within the same file.

Suggested changeset 1
connectors/jdbc/src/main/java/io/camunda/connector/jdbc/model/client/JdbiJsonHelper.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/connectors/jdbc/src/main/java/io/camunda/connector/jdbc/model/client/JdbiJsonHelper.java b/connectors/jdbc/src/main/java/io/camunda/connector/jdbc/model/client/JdbiJsonHelper.java
--- a/connectors/jdbc/src/main/java/io/camunda/connector/jdbc/model/client/JdbiJsonHelper.java
+++ b/connectors/jdbc/src/main/java/io/camunda/connector/jdbc/model/client/JdbiJsonHelper.java
@@ -22,3 +22,3 @@
             Object value = rs.getObject(i);
-            if (isPotentiallyJsonColumn(rs.getMetaData().getColumnType(i), value)) {
+            if (isPotentiallyJsonColumn(rs.getMetaData().getColumnType(i))) {
               try {
@@ -38,3 +38,3 @@
 
-  private static boolean isPotentiallyJsonColumn(int columnType, Object value) {
+  private static boolean isPotentiallyJsonColumn(int columnType) {
     Set<Integer> jsonCompatibleTypes =
EOF
@@ -22,3 +22,3 @@
Object value = rs.getObject(i);
if (isPotentiallyJsonColumn(rs.getMetaData().getColumnType(i), value)) {
if (isPotentiallyJsonColumn(rs.getMetaData().getColumnType(i))) {
try {
@@ -38,3 +38,3 @@

private static boolean isPotentiallyJsonColumn(int columnType, Object value) {
private static boolean isPotentiallyJsonColumn(int columnType) {
Set<Integer> jsonCompatibleTypes =
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
String columnName = rs.getMetaData().getColumnLabel(i);
Object value = rs.getObject(i);
if (isPotentiallyJsonColumn(rs.getMetaData().getColumnType(i), value)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try using rs.getMetaData().getColumnTypeName?

It might be more useful as it returns the

type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned.

Instead of the JDBC type returned by getColumnType.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SQL Connector] Add JSON support
2 participants