* data tables settings ui * install runed * zod 4 fixes * use new toJSONSchema * Migrate ducklake catalogs to more generic custom instance databases * fix compilation * Safety conversion for old duckdb ffi * data tables settings * ts client basis * inline run works * datatables work * Revert "datatables work" This reverts commit6e1588d59e. * datatables work (without leaking pg credentials) * println * separate sqlUtils.ts * nit * Separate custom instance db Select and Wizard components * nit * nit wording * add tags to custom instance dbs * error when trying to use ducklake as datatable or opposite * show status in dropdown * data table instance setup works * sqk function for ducklake * factorize logic * fix temp reactivity * Data table assetexplore * Migrate S3 permissions to modal * Revert "Migrate S3 permissions to modal" This reverts commit0631d03cb0. * nit query -> fetch * Custom instance setup new look * run_language_executor separate fn * run_inline param * nit wording * Better typed client * Data tables display as assets in frontend * asset db icon * nit * cleaner errors * nit * Fix sed calls in mac * run_inline_script_preview in python client * basic python datatable client * datatable and datalake parser in python * ducklake client python * nit fix * Fix migration producing NULL instead of {} when no custom databases * merge conflict fail * python ducklake client arg fix * parse or infer sql types in ts client * ts asset parser, detect datatable & ducklake R/W * fix sql repl for other read ops than select * export type SqlTemplateFunction * rename list_custom_instance_pg_databases * typecheck datatable and ducklake name in Typescript * Fix typecheck datatable and ducklake in TS * declare module overriding instead of extending * infer_sql_type in python client * SqlQuery object in python * fix merge conflicts * update const_format * CI fix * factor out to var_identifiers * sqlx prepare * unnecessary security (admin is required) * clearer comment * ee repo ref * nit snake case * claude step 1: detect var declarations * move detect_sql_access_type to common mod * claude step 2: detect when saved vars are queried * Revert "claude step 2: detect when saved vars are queried" This reverts commit1e1f930568. * Revert "claude step 1: detect var declarations" This reverts commitf866f4819d. * remove ducklake/datatable and default * detect data table assigns in var_identifiers * Python parser successfully infers R/W/RW from ducklake / datatable * still register ducklake/datatable if not used as unknown R/W * Go to settings button in Assets Dropdown on not found * nit * sqlx prepare fail * manual fix, somehow sqlx prepare won't do it * fix frontend ci * ee repo ref * ducklake_user doesnt exist in unit tests * nit fix * ui nit * nit * nit missing clone * fork ducklakes and datatables * fix surface hover bug * stupid mistake * better deeply reactive mutable derived * Ducklake picker * Editor bar data tables * DuckDB supports datatables * datatable in duckdb asset parser * duckdb asset parser var_identifiers * Revert "duckdb asset parser var_identifiers" This reverts commit88068b1a77. * sqlx prepare * Box pin in test_workflow_as_code to fix stack overflow * go to settings button * ee repo ref * fix compilation * wording nit
93 lines
2.6 KiB
Svelte
93 lines
2.6 KiB
Svelte
<script module lang="ts">
|
|
export function assetCanBeExplored(
|
|
asset: Asset,
|
|
_resourceMetadata?: { resource_type?: string }
|
|
): boolean {
|
|
return (
|
|
asset.kind === 'ducklake' ||
|
|
asset.kind === 'datatable' ||
|
|
asset.kind === 's3object' ||
|
|
(asset.kind === 'resource' && isDbType(_resourceMetadata?.resource_type))
|
|
)
|
|
}
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
import { isDbType } from '$lib/components/dbTypes'
|
|
import { formatAsset, type Asset } from '$lib/components/assets/lib'
|
|
import { Button, ButtonType } from '$lib/components/common'
|
|
import DbManagerDrawer from '$lib/components/DBManagerDrawer.svelte'
|
|
import S3FilePicker from '$lib/components/S3FilePicker.svelte'
|
|
import { userStore } from '$lib/stores'
|
|
import { isS3Uri } from '$lib/utils'
|
|
import { Database, File } from 'lucide-svelte'
|
|
import DucklakeIcon from './icons/DucklakeIcon.svelte'
|
|
|
|
const {
|
|
asset,
|
|
_resourceMetadata,
|
|
s3FilePicker,
|
|
dbManagerDrawer,
|
|
onClick,
|
|
class: className = '',
|
|
noText = false,
|
|
buttonVariant = 'default',
|
|
btnClasses = '',
|
|
disabled = false
|
|
}: {
|
|
asset: Asset
|
|
_resourceMetadata?: { resource_type?: string }
|
|
s3FilePicker?: S3FilePicker
|
|
dbManagerDrawer?: DbManagerDrawer
|
|
onClick?: () => void
|
|
class?: string
|
|
noText?: boolean
|
|
buttonVariant?: ButtonType.Variant
|
|
btnClasses?: string
|
|
disabled?: boolean
|
|
} = $props()
|
|
const assetUri = $derived(formatAsset(asset))
|
|
</script>
|
|
|
|
<Button
|
|
disabled={$userStore?.operator || disabled}
|
|
unifiedSize={'md'}
|
|
variant={buttonVariant}
|
|
wrapperClasses={className}
|
|
iconOnly={noText}
|
|
{btnClasses}
|
|
on:click={async () => {
|
|
if (asset.kind === 'resource' && isDbType(_resourceMetadata?.resource_type)) {
|
|
dbManagerDrawer?.openDrawer({
|
|
type: 'database',
|
|
resourceType: _resourceMetadata.resource_type,
|
|
resourcePath: asset.path
|
|
})
|
|
} else if (asset.kind === 's3object' && isS3Uri(assetUri)) {
|
|
s3FilePicker?.open(assetUri)
|
|
} else if (asset.kind === 'ducklake') {
|
|
dbManagerDrawer?.openDrawer({ type: 'ducklake', ducklake: asset.path })
|
|
} else if (asset.kind === 'datatable') {
|
|
dbManagerDrawer?.openDrawer({
|
|
type: 'database',
|
|
resourceType: 'postgresql',
|
|
resourcePath: `datatable://${asset.path}`
|
|
})
|
|
}
|
|
onClick?.()
|
|
}}
|
|
endIcon={asset.kind === 's3object'
|
|
? { icon: File }
|
|
: asset.kind === 'resource' || asset.kind === 'datatable'
|
|
? { icon: Database }
|
|
: asset.kind === 'ducklake'
|
|
? { icon: DucklakeIcon }
|
|
: undefined}
|
|
>
|
|
{#if asset.kind === 's3object'}
|
|
<span class:hidden={noText}>Explore</span>
|
|
{:else if asset.kind === 'resource' || asset.kind === 'ducklake' || asset.kind === 'datatable'}
|
|
<span class:hidden={noText}>Manage</span>
|
|
{/if}
|
|
</Button>
|