Skip to content

Commit

Permalink
Feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-- committed Dec 4, 2024
1 parent 4bbda4f commit 659607b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ INSERT INTO duckdb.secrets
VALUES ('Azure', '<your connection string>');
```

Note: writes to Azure are not yet supported, [here][duckdb/duckdb_azure#44] is the current discussion for more information.

### Connect with MotherDuck

pg_duckdb also integrates with [MotherDuck][md]. To enable this support you first need to [generate an access token][md-access-token] and then add the following line to your `postgresql.conf` file:
Expand Down
2 changes: 0 additions & 2 deletions include/pgduckdb/pgduckdb_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ typedef struct DuckdbSecret {
std::string connection_string; // Used for Azure
} DuckdbSecret;

bool DoesSecretRequiresKeyIdOrSecret(const SecretType type);

std::string SecretTypeToString(SecretType type);

extern std::vector<DuckdbSecret> ReadDuckdbSecrets();
Expand Down
2 changes: 1 addition & 1 deletion sql/pg_duckdb--0.1.0--0.2.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ALTER TABLE duckdb.secrets ALTER COLUMN secret DROP NOT NULL;

-- Update "type_constraint" CHECK on "type" to allow "Azure"
ALTER TABLE duckdb.secrets DROP CONSTRAINT type_constraint;
ALTER TABLE duckdb.secrets ADD CONSTRAINT type_constraint CHECK (type IN ('S3', 'GCS', 'R2', 'Azure'));
ALTER TABLE duckdb.secrets ADD CONSTRAINT type_constraint CHECK (upper(type) IN ('S3', 'GCS', 'R2', 'AZURE'));

-- Add "azure_connection_string" column
ALTER TABLE duckdb.secrets ADD COLUMN connection_string TEXT;
6 changes: 2 additions & 4 deletions src/pgduckdb_duckdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,10 @@ DuckDBManager::LoadSecrets(duckdb::ClientContext &context) {
query << "CREATE SECRET pgduckb_secret_" << secret_id << " ";
query << "(TYPE " << SecretTypeToString(secret.type) << ", ";

if (DoesSecretRequiresKeyIdOrSecret(secret.type)) {
WriteSecretQueryForS3R2OrGCP(secret, query);
} else if (secret.type == SecretType::AZURE) {
if (secret.type == SecretType::AZURE) {
query << "CONNECTION_STRING '" << secret.connection_string << "'";
} else {
throw std::runtime_error("Invalid secret type: '" + std::to_string(secret.type) + "'");
WriteSecretQueryForS3R2OrGCP(secret, query);
}

query << ");";
Expand Down

0 comments on commit 659607b

Please sign in to comment.