Skip to content

Commit f44cfdd

Browse files
authored
Merge pull request #89 from evidence-dev/88-changes-required-for-upcoming-duckdb-v14-release
chore(duckdb): fully move over to new extension APIs for DuckDB v1.4-andium
2 parents 96fbf22 + e04cba4 commit f44cfdd

File tree

11 files changed

+17
-74
lines changed

11 files changed

+17
-74
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323

2424
duckdb-stable-build:
2525
name: Build extension binaries
26-
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.2
26+
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
2727
with:
28-
duckdb_version: v1.3.2
29-
ci_tools_version: v1.3.2
28+
duckdb_version: v1.4-andium
29+
ci_tools_version: main
3030
extension_name: gsheets
3131
exclude_archs: "windows_amd64_rtools"

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "duckdb"]
22
path = duckdb
33
url = https://github.com/duckdb/duckdb
4-
branch = main
4+
branch = v1.4-andium
55
[submodule "extension-ci-tools"]
66
path = extension-ci-tools
77
url = https://github.com/duckdb/extension-ci-tools

docs/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ INSTALL gsheets FROM community;
2424
LOAD gsheets;
2525
```
2626

27-
The latest version of [DuckDB](https://duckdb.org/docs/installation) (currently 1.3.2) is supported.
27+
The latest version of [DuckDB](https://duckdb.org/docs/installation) (currently 1.4.0) is supported.
2828

2929
## Usage
3030

duckdb

Submodule duckdb updated 6667 files

src/gsheets_auth.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#include "duckdb.hpp"
22

3-
#ifndef DUCKDB_CPP_EXTENSION_ENTRY
4-
#include "duckdb/main/extension_util.hpp"
5-
#endif
6-
73
#include "gsheets_auth.hpp"
84
#include "gsheets_utils.hpp"
95
#include "gsheets_get_token.hpp"
@@ -117,12 +113,7 @@ static unique_ptr<BaseSecret> CreateGsheetSecretFromKeyFile(ClientContext &conte
117113
return std::move(result);
118114
}
119115

120-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
121-
void CreateGsheetSecretFunctions::Register(ExtensionLoader &loader)
122-
#else
123-
void CreateGsheetSecretFunctions::Register(DatabaseInstance &db)
124-
#endif
125-
{
116+
void CreateGsheetSecretFunctions::Register(ExtensionLoader &loader) {
126117
string type = "gsheet";
127118

128119
// Register the new type
@@ -146,17 +137,10 @@ void CreateGsheetSecretFunctions::Register(DatabaseInstance &db)
146137
key_file_function.named_parameters["filepath"] = LogicalType::VARCHAR;
147138
RegisterCommonSecretParameters(key_file_function);
148139

149-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
150140
loader.RegisterSecretType(secret_type);
151141
loader.RegisterFunction(access_token_function);
152142
loader.RegisterFunction(oauth_function);
153143
loader.RegisterFunction(key_file_function);
154-
#else
155-
ExtensionUtil::RegisterSecretType(db, secret_type);
156-
ExtensionUtil::RegisterFunction(db, access_token_function);
157-
ExtensionUtil::RegisterFunction(db, oauth_function);
158-
ExtensionUtil::RegisterFunction(db, key_file_function);
159-
#endif
160144
}
161145

162146
std::string InitiateOAuthFlow() {

src/gsheets_extension.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
#include "duckdb.hpp"
44

5-
#ifndef DUCKDB_CPP_EXTENSION_ENTRY
6-
#include "duckdb/main/extension_util.hpp"
7-
#endif
8-
95
#include "duckdb/parser/expression/constant_expression.hpp"
106
#include "duckdb/parser/expression/function_expression.hpp"
117
#include "duckdb/parser/tableref/table_function_ref.hpp"
@@ -51,11 +47,7 @@ unique_ptr<TableRef> ReadSheetReplacement(ClientContext &context, ReplacementSca
5147
return std::move(table_function);
5248
}
5349

54-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
5550
static void LoadInternal(ExtensionLoader &loader) {
56-
#else
57-
static void LoadInternal(DatabaseInstance &db) {
58-
#endif
5951
// Initialize OpenSSL
6052
SSL_library_init();
6153
SSL_load_error_strings();
@@ -70,30 +62,17 @@ static void LoadInternal(DatabaseInstance &db) {
7062

7163
GSheetCopyFunction gsheet_copy_function;
7264

73-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
7465
loader.RegisterFunction(read_gsheet_function);
7566
loader.RegisterFunction(gsheet_copy_function);
7667
CreateGsheetSecretFunctions::Register(loader);
7768
auto &config = DBConfig::GetConfig(loader.GetDatabaseInstance());
78-
#else
79-
ExtensionUtil::RegisterFunction(db, read_gsheet_function);
80-
ExtensionUtil::RegisterFunction(db, gsheet_copy_function);
81-
CreateGsheetSecretFunctions::Register(db);
82-
auto &config = DBConfig::GetConfig(db);
83-
#endif
8469

8570
config.replacement_scans.emplace_back(ReadSheetReplacement);
8671
}
8772

88-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
8973
void GsheetsExtension::Load(ExtensionLoader &loader) {
9074
LoadInternal(loader);
9175
}
92-
#else
93-
void GsheetsExtension::Load(DuckDB &db) {
94-
LoadInternal(*db.instance);
95-
}
96-
#endif
9776

9877
std::string GsheetsExtension::Name() {
9978
return "gsheets";
@@ -111,20 +90,9 @@ std::string GsheetsExtension::Version() const {
11190

11291
extern "C" {
11392

114-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
11593
DUCKDB_CPP_EXTENSION_ENTRY(gsheets, loader) {
11694
duckdb::LoadInternal(loader);
11795
}
118-
#else
119-
DUCKDB_EXTENSION_API void gsheets_init(duckdb::DatabaseInstance &db) {
120-
duckdb::DuckDB db_wrapper(db);
121-
db_wrapper.LoadExtension<duckdb::GsheetsExtension>();
122-
}
123-
124-
DUCKDB_EXTENSION_API const char *gsheets_version() {
125-
return duckdb::DuckDB::LibraryVersion();
126-
}
127-
#endif
12896
}
12997

13098
#ifndef DUCKDB_EXTENSION_MAIN

src/gsheets_read.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ unique_ptr<FunctionData> ReadSheetBind(ClientContext &context, TableFunctionBind
267267
bind_data->names = names;
268268
bind_data->return_types = return_types;
269269

270-
return bind_data;
270+
return std::move(bind_data);
271271
}
272272

273273
} // namespace duckdb

src/include/gsheets_auth.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#pragma once
22

3-
#include <string>
43
#include "duckdb.hpp"
54

5+
#include <string>
6+
67
namespace duckdb {
78

89
std::string read_token_from_file(const std::string &file_path);
@@ -11,12 +12,7 @@ std::string InitiateOAuthFlow();
1112

1213
struct CreateGsheetSecretFunctions {
1314
public:
14-
//! Register all CreateSecretFunctions
15-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
1615
static void Register(ExtensionLoader &loader);
17-
#else
18-
static void Register(DatabaseInstance &db);
19-
#endif
2016
};
2117

2218
} // namespace duckdb

src/include/gsheets_extension.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ namespace duckdb {
66

77
class GsheetsExtension : public Extension {
88
public:
9-
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
109
void Load(ExtensionLoader &loader) override;
11-
#else
12-
void Load(DuckDB &db) override;
13-
#endif
1410
std::string Name() override;
1511
std::string Version() const override;
1612
};

0 commit comments

Comments
 (0)