Skip to content

Commit e675799

Browse files
authored
fix: ducklake default connection extra_args (#7509)
* Ducklake default extra_args * indicator nit
1 parent 15d1fb5 commit e675799

File tree

4 files changed

+65
-22
lines changed

4 files changed

+65
-22
lines changed

backend/windmill-api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20606,6 +20606,8 @@ components:
2060620606
type: string
2060720607
required:
2060820608
- path
20609+
extra_args:
20610+
type: string
2060920611

2061020612
DataTableSettings:
2061120613
type: object

backend/windmill-common/src/workspaces.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ pub async fn get_datatable_resource_from_db_unchecked(
213213
pub struct Ducklake {
214214
pub catalog: DucklakeCatalog,
215215
pub storage: DucklakeStorage,
216+
#[serde(skip_serializing_if = "Option::is_none")]
217+
pub extra_args: Option<String>,
216218
}
217219

218220
#[derive(Deserialize, Serialize, Debug)]
@@ -244,6 +246,8 @@ pub struct DucklakeWithConnData {
244246
pub catalog: DucklakeCatalog,
245247
pub catalog_resource: serde_json::Value,
246248
pub storage: DucklakeStorage,
249+
#[serde(skip_serializing_if = "Option::is_none")]
250+
pub extra_args: Option<String>,
247251
}
248252

249253
pub async fn get_ducklake_from_db_unchecked(
@@ -287,6 +291,7 @@ pub async fn get_ducklake_from_db_unchecked(
287291
catalog_resource,
288292
catalog: ducklake.catalog,
289293
storage: ducklake.storage,
294+
extra_args: ducklake.extra_args,
290295
};
291296
Ok(ducklake)
292297
}

backend/windmill-worker/src/duckdb_executor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,12 @@ async fn transform_attach_ducklake(
575575
} else {
576576
format!(", OVERRIDE_DATA_PATH TRUE{extra_args}")
577577
};
578+
let extra_args = if let Some(default_extra_args) = ducklake.extra_args {
579+
// premise : extra_args is always non empty (and doesn't end with a comma given it's valid)
580+
format!("{},{}", extra_args, default_extra_args)
581+
} else {
582+
extra_args
583+
};
578584

579585
let attach_str = format!(
580586
"ATTACH 'ducklake:{db_type}:{db_conn_str}' AS {alias_name} (DATA_PATH 's3://{storage}/{data_path}'{extra_args});",

frontend/src/lib/components/workspaceSettings/DucklakeSettings.svelte

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
storage?: string
1313
path: string
1414
}
15+
extra_args?: string
1516
}[]
1617
}
1718
@@ -42,15 +43,16 @@
4243
4344
s.ducklakes[ducklake.name] = {
4445
catalog: ducklake.catalog,
45-
storage: ducklake.storage
46+
storage: ducklake.storage,
47+
extra_args: ducklake.extra_args || undefined
4648
}
4749
}
4850
return s
4951
}
5052
</script>
5153

5254
<script>
53-
import { Plus } from 'lucide-svelte'
55+
import { Plus, SettingsIcon } from 'lucide-svelte'
5456
5557
import Button from '../common/button/Button.svelte'
5658
@@ -81,6 +83,7 @@
8183
import { isCustomInstanceDbEnabled } from './utils.svelte'
8284
import { resource } from 'runed'
8385
import CustomInstanceDbSelect from './CustomInstanceDbSelect.svelte'
86+
import Label from '../Label.svelte'
8487
8588
const DEFAULT_DUCKLAKE_CATALOG_NAME = 'ducklake_catalog'
8689
@@ -316,29 +319,56 @@
316319
</div>
317320
</Cell>
318321
<Cell class="w-12">
319-
{#if ducklakeIsDirty[ducklake.name]}
320-
<Popover
321-
openOnHover
322-
contentClasses="p-2 text-sm text-secondary italic"
323-
class="cursor-not-allowed"
324-
>
322+
<div class="flex gap-2">
323+
<Popover contentClasses="p-4" enableFlyTransition closeOnOtherPopoverOpen>
325324
<svelte:fragment slot="trigger">
326-
<ExploreAssetButton
327-
class="h-9"
328-
asset={{ kind: 'ducklake', path: ducklake.name }}
329-
{dbManagerDrawer}
330-
disabled
331-
/>
325+
<div class="relative">
326+
<Button variant="default" iconOnly size="sm" endIcon={{ icon: SettingsIcon }} />
327+
{#if ducklake.extra_args}
328+
<div
329+
class="absolute -top-0.5 -right-0.5 w-2 h-2 bg-accent rounded-full border border-surface"
330+
></div>
331+
{/if}
332+
</div>
333+
</svelte:fragment>
334+
<svelte:fragment slot="content">
335+
<Label
336+
label="Extra args"
337+
tooltip="Additional arguments to pass in the ATTACH command. The argument list is substituted as-is. Separate them with commas."
338+
>
339+
<TextInput
340+
bind:value={ducklake.extra_args}
341+
class="min-w-96"
342+
underlyingInputEl="textarea"
343+
inputProps={{ placeholder: "METADATA_SCHEMA 'schema', ENCRYPTED true" }}
344+
/>
345+
</Label>
332346
</svelte:fragment>
333-
<svelte:fragment slot="content">Please save settings first</svelte:fragment>
334347
</Popover>
335-
{:else}
336-
<ExploreAssetButton
337-
class="h-9"
338-
asset={{ kind: 'ducklake', path: ducklake.name }}
339-
{dbManagerDrawer}
340-
/>
341-
{/if}
348+
{#if ducklakeIsDirty[ducklake.name]}
349+
<Popover
350+
openOnHover
351+
contentClasses="p-2 text-sm text-secondary italic"
352+
class="cursor-not-allowed"
353+
>
354+
<svelte:fragment slot="trigger">
355+
<ExploreAssetButton
356+
class="h-9"
357+
asset={{ kind: 'ducklake', path: ducklake.name }}
358+
{dbManagerDrawer}
359+
disabled
360+
/>
361+
</svelte:fragment>
362+
<svelte:fragment slot="content">Please save settings first</svelte:fragment>
363+
</Popover>
364+
{:else}
365+
<ExploreAssetButton
366+
class="h-9"
367+
asset={{ kind: 'ducklake', path: ducklake.name }}
368+
{dbManagerDrawer}
369+
/>
370+
{/if}
371+
</div>
342372
</Cell>
343373
<Cell class="w-12">
344374
<CloseButton small on:close={() => removeDucklake(ducklakeIndex)} />

0 commit comments

Comments
 (0)