Skip to content

Upgrade JDBC & SDK verisons #179

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

Merged
merged 4 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion jooq-dialect/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
## 1.1.0 ##
- Upgrade to new version of JDBC & SDK

## 1.0.1 ##
- Fixed bug with `useIndex` - skip the table name (`from view`)

## 1.0.0 ##

- `REPLACE` / `UPSERT` builders from YDB
- `REPLACE` / `UPSERT` builders from YDB
- Supported VIEW INDEX from `useIndex("index_name")` HintedTable
- Generated tables from schema
2 changes: 1 addition & 1 deletion jooq-dialect/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-java-dialects/blob/main/LICENSE.md)
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Ftech%2Fydb%2Fdialects%2Fhibernate-ydb-dialect-v5%2Fmaven-metadata.xml)](https://mvnrepository.com/artifact/tech.ydb.dialects/jooq-ydb-dialect)
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Ftech%2Fydb%2Fdialects%2Fjooq-ydb-dialect%2Fmaven-metadata.xml)](https://mvnrepository.com/artifact/tech.ydb.dialects/jooq-ydb-dialect)
[![CI](https://img.shields.io/github/actions/workflow/status/ydb-platform/ydb-java-dialects/ci-jooq-dialect.yaml?branch=main&label=CI)](https://github.com/ydb-platform/ydb-java-dialects/actions/workflows/ci-jooq-dialect.yaml)

# YDB JOOQ Dialect
Expand Down
6 changes: 3 additions & 3 deletions jooq-dialect/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>tech.ydb.dialects</groupId>
<artifactId>jooq-ydb-dialect</artifactId>
<version>1.0.1</version>
<version>1.1.0</version>

<name>YDB JOOQ Dialect module</name>
<description>YDB JOOQ Dialect module</description>
Expand Down Expand Up @@ -52,8 +52,8 @@

<jooq.version>3.19.0</jooq.version>

<ydb.sdk.version>2.2.6</ydb.sdk.version>
<ydb.jdbc.version>2.2.3</ydb.jdbc.version>
<ydb.sdk.version>2.3.8</ydb.sdk.version>
<ydb.jdbc.version>2.3.7</ydb.jdbc.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package tech.ydb.jooq.codegen;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.jooq.*;
import org.jooq.impl.DSL;
import org.jooq.meta.*;
import org.jooq.tools.JooqLogger;

import tech.ydb.jdbc.YdbConnection;
import tech.ydb.jdbc.context.SchemeExecutor;
import tech.ydb.jdbc.context.YdbContext;
Expand All @@ -17,11 +23,6 @@
import tech.ydb.table.description.TableIndex;
import tech.ydb.table.settings.DescribeTableSettings;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class YdbDatabase extends AbstractDatabase implements ResultQueryDatabase {
private static final JooqLogger log = JooqLogger.getLogger(YdbDatabase.class);

Expand All @@ -39,7 +40,7 @@ private YdbContext getContext() {
}

private String getDatabaseName() {
return getContext().getDatabase().substring(1);
return getContext().getPrefixPath().substring(1);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import org.jooq.Binding;
import org.jooq.JSON;
import org.jooq.JSONB;
Expand All @@ -20,7 +21,7 @@
import org.jooq.types.UInteger;
import org.jooq.types.ULong;
import org.jooq.types.UShort;
import tech.ydb.jdbc.YdbConst;

import tech.ydb.jdbc.impl.YdbTypes;
import tech.ydb.jooq.binding.DateBinding;
import tech.ydb.jooq.binding.DatetimeBinding;
Expand All @@ -36,6 +37,7 @@
import tech.ydb.jooq.value.YSON;
import tech.ydb.table.description.TableColumn;
import tech.ydb.table.description.TableDescription;
import tech.ydb.table.values.DecimalType;
import tech.ydb.table.values.Type;

public class YdbTableDefinition extends AbstractTableDefinition {
Expand Down Expand Up @@ -71,7 +73,7 @@ protected List<ColumnDefinition> getElements0() {
kind = type.getKind();
}

int decimalDigits = kind == Type.Kind.DECIMAL ? YdbConst.SQL_DECIMAL_DEFAULT_PRECISION : 0;
int decimalDigits = kind == Type.Kind.DECIMAL ? ((DecimalType) type).getPrecision(): 0;

String typeName = type.toString();
Class<? extends Binding<?, ?>> binding = getBinding(typeName);
Expand Down
13 changes: 7 additions & 6 deletions jooq-dialect/src/test/java/tech/ydb/jooq/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.RegisterExtension;

import tech.ydb.test.junit5.YdbHelperExtension;

public abstract class BaseTest {
Expand Down Expand Up @@ -66,15 +67,15 @@ protected static List<DateTableRecord> getExampleDateRecords() {
public static void beforeAll() {
dsl = YDB.using(jdbcUrl());

dsl.createTable("series")
dsl.createTableIfNotExists("series")
.column("series_id", YdbTypes.UINT64)
.column("title", YdbTypes.UTF8)
.column("series_info", YdbTypes.UTF8)
.column("release_date", YdbTypes.UINT64)
.primaryKey("series_id")
.execute();

dsl.createTable("seasons")
dsl.createTableIfNotExists("seasons")
.column("series_id", YdbTypes.UINT64)
.column("season_id", YdbTypes.UINT64)
.column("title", YdbTypes.UTF8)
Expand All @@ -83,7 +84,7 @@ public static void beforeAll() {
.primaryKey("series_id", "season_id")
.execute();

dsl.createTable("episodes")
dsl.createTableIfNotExists("episodes")
.column("series_id", YdbTypes.UINT64)
.column("season_id", YdbTypes.UINT64)
.column("episode_id", YdbTypes.UINT64)
Expand All @@ -92,15 +93,15 @@ public static void beforeAll() {
.primaryKey("series_id", "season_id", "episode_id")
.execute();

dsl.createTable("hard_table")
dsl.createTableIfNotExists("hard_table")
.column("id", YdbTypes.STRING)
.column("first", YdbTypes.JSON)
.column("second", YdbTypes.JSONDOCUMENT)
.column("third", YdbTypes.YSON)
.primaryKey("id")
.execute();

dsl.createTable("date_table")
dsl.createTableIfNotExists("date_table")
.column("id", YdbTypes.UINT64)
.column("int_col", YdbTypes.INT32)
.column("percent", YdbTypes.DOUBLE)
Expand All @@ -112,7 +113,7 @@ public static void beforeAll() {
.primaryKey("id")
.execute();

CreateTableElementListStep createQuery = dsl.createTable("numeric").column("id", YdbTypes.INT32);
CreateTableElementListStep createQuery = dsl.createTableIfNotExists("numeric").column("id", YdbTypes.INT32);

for (int i = 1; i <= 23; i++) {
createQuery.column(Integer.toString(i), YdbTypes.INT32);
Expand Down