Skip to content
Open
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
8 changes: 5 additions & 3 deletions dbatools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
'Grant-DbaAgPermission',
'Export-DbaCsv',
'Import-DbaCsv',
'Import-DbaParquet',
'Import-DbaPfDataCollectorSetTemplate',
'Import-DbaRegServer',
'Import-DbaSpConfigure',
Expand All @@ -436,9 +437,10 @@
'Install-DbaDarlingData',
'Install-DbaFirstResponderKit',
'Install-DbaInstance',
'Install-DbaMaintenanceSolution',
'Install-DbaMultiTool',
'Install-DbaSqlPackage',
'Install-DbaMaintenanceSolution',
'Install-DbaMultiTool',
'Install-DbaParquet',
'Install-DbaSqlPackage',
'Install-DbaSqlWatch',
'Install-DbaWhoIsActive',
'Invoke-DbaDbAzSqlTip',
Expand Down
4 changes: 3 additions & 1 deletion dbatools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ if ($PSVersionTable.PSVersion.Major -lt 5) {
'Resolve-DbaPath',
'Export-DbaCsv',
'Import-DbaCsv',
'Import-DbaParquet',
'Invoke-DbaDbDataMasking',
'New-DbaDbMaskingConfig',
'Get-DbaDbccSessionBuffer',
Expand Down Expand Up @@ -883,6 +884,7 @@ if ($PSVersionTable.PSVersion.Major -lt 5) {
'Export-DbaSysDbUserObject',
'Test-DbaDbQueryStore',
'Install-DbaMultiTool',
'Install-DbaParquet',
'New-DbaAgentOperator',
'Remove-DbaAgentOperator',
'Remove-DbaDbTableData',
Expand Down Expand Up @@ -1229,4 +1231,4 @@ Register-DbatoolsConfig'
}
}

[Dataplat.Dbatools.dbaSystem.SystemHost]::ModuleImported = $true
[Dataplat.Dbatools.dbaSystem.SystemHost]::ModuleImported = $true
5 changes: 4 additions & 1 deletion private/configurations/settings/paths.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ if (-not (Test-Path -Path $script:AppData)) {
# The default path where dbatools stores persistent data
Set-DbatoolsConfig -FullName 'Path.DbatoolsData' -Value (Join-DbaPath $script:AppData "PowerShell" "dbatools") -Initialize -Validation string -Handler { } -Description "The path where dbatools stores persistent data on a per user basis."

# The default path where dbatools stores Parquet.NET assemblies
Set-DbatoolsConfig -FullName 'Path.DbatoolsParquet' -Value (Join-DbaPath $script:AppData "PowerShell" "dbatools" "parquet") -Initialize -Validation string -Handler { } -Description "The path where dbatools stores Parquet.NET assemblies."

# The default path where dbatools stores temporary data
Set-DbatoolsConfig -FullName 'Path.DbatoolsTemp' -Value $temp -Initialize -Validation string -Handler { } -Description "The path where dbatools stores temporary data."

Expand Down Expand Up @@ -115,4 +118,4 @@ Set-DbatoolsConfig -FullName 'Path.Managed.Temp' -Value $path_Temp -Initialize -
Set-DbatoolsConfig -FullName 'Path.Managed.LocalAppData' -Value $path_LocalAppData -Initialize -Validation 'string' -Description "Path pointing at the LocalAppData path. Used with Get-DbatoolsPath."
Set-DbatoolsConfig -FullName 'Path.Managed.AppData' -Value $path_AppData -Initialize -Validation 'string' -Description "Path pointing at the AppData path. Used with Get-DbatoolsPath."
Set-DbatoolsConfig -FullName 'Path.Managed.ProgramData' -Value $path_ProgramData -Initialize -Validation 'string' -Description "Path pointing at the ProgramData path. Used with Get-DbatoolsPath."
#endregion Managed Path Stuff
#endregion Managed Path Stuff
81 changes: 81 additions & 0 deletions private/functions/Get-DbaParquetPath.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
function Get-DbaParquetPath {
<#
.SYNOPSIS
Gets the path to the Parquet.NET assembly.

.DESCRIPTION
Finds the Parquet.NET assembly used by Import-DbaParquet. Checks the currently loaded assembly first,
then the dbatools data directory populated by Install-DbaParquet, then the legacy bundled module path.

.PARAMETER EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

.NOTES
Tags: Parquet, Import
Author: Jovan Popovic, the dbatools team + Claude

Website: https://dbatools.io
Copyright: (c) 2026 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT

.OUTPUTS
System.String. The path to the Parquet.NET assembly if found, otherwise $null.
#>
[CmdletBinding()]
param (
[switch]$Silent,
[switch]$EnableException
)

$loadedAssembly = [System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GetName().Name -eq "Parquet" } | Select-Object -First 1
if ($loadedAssembly -and $loadedAssembly.Location -and (Test-Path -Path $loadedAssembly.Location)) {
Write-Message -Level Verbose -Message "Found loaded Parquet.NET assembly at: $($loadedAssembly.Location)"
return $loadedAssembly.Location
}

$searchPaths = @()

$configuredPath = Get-DbatoolsConfigValue -FullName "Path.DbatoolsParquet"
if ($configuredPath) {
$configuredPath = $configuredPath.TrimEnd("/", "\")
$searchPaths += Join-Path -Path $configuredPath -ChildPath "Parquet.dll"
$searchPaths += Join-Path -Path $configuredPath -ChildPath "Parquet.Net.dll"
}

$dbatoolsData = Get-DbatoolsConfigValue -FullName "Path.DbatoolsData"
if ($dbatoolsData) {
$dbatoolsData = $dbatoolsData.TrimEnd("/", "\")
$searchPaths += Join-Path -Path $dbatoolsData -ChildPath "parquet" | Join-Path -ChildPath "Parquet.dll"
$searchPaths += Join-Path -Path $dbatoolsData -ChildPath "parquet" | Join-Path -ChildPath "Parquet.Net.dll"
}

if ($script:PSModuleRoot) {
$searchPaths += Join-Path -Path $script:PSModuleRoot -ChildPath "bin" | Join-Path -ChildPath "parquet" | Join-Path -ChildPath "Parquet.dll"
$searchPaths += Join-Path -Path $script:PSModuleRoot -ChildPath "bin" | Join-Path -ChildPath "parquet" | Join-Path -ChildPath "Parquet.Net.dll"
}

foreach ($path in $searchPaths) {
if (Test-Path -Path $path) {
Write-Message -Level Verbose -Message "Found Parquet.NET assembly at: $path"
return $path
}
}

$message = @"
Could not find Parquet.NET. Parquet.NET is required for Import-DbaParquet.

To install Parquet.NET, use:
Install-DbaParquet

This will download Parquet.NET and its managed dependencies to your dbatools data directory.
"@

if ($Silent) {
return $null
}

Stop-Function -Message $message -Target "Parquet.NET" -EnableException $EnableException
return $null
}
Loading
Loading