Skip to content

Commit

Permalink
Merge pull request #25 from tableau/release/4.1.0
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
drache42 authored Jun 28, 2024
2 parents 353414e + 26583aa commit a1d6836
Show file tree
Hide file tree
Showing 383 changed files with 12,308 additions and 1,487 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"docfx": {
"version": "2.75.3",
"version": "2.76.0",
"commands": [
"docfx"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
with:
name: dotnet-results-${{ matrix.os }}-${{ matrix.config }}
path: TestResults-${{ matrix.os }}-${{ matrix.config }}
if-no-files-found: error
if-no-files-found: error
2 changes: 1 addition & 1 deletion .github/workflows/publishdocs-dryrun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dotnet
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Generate API Reference Docs..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publishdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dotnet
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Generate API Reference Docs..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: ./.github/actions/setup-dotnet
if: ${{ env.PUBLISH_PACKAGE_KEY != '' && inputs.runs-on-config != 'self-hosted' }}
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
if: ${{ env.PUBLISH_PACKAGE_KEY != '' && inputs.runs-on-config != 'self-hosted' }}
with:
python-version: ${{ vars.PYTHON_TEST_VERSIONS }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dotnet
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_TEST_VERSIONS }}
cache: 'pip' # caching pip dependencies
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Version>4.0.0</Version>
<Version>4.1.0</Version>
<Authors>Salesforce, Inc.</Authors>
<Company>Salesforce, Inc.</Company>
<Copyright>Copyright (c) 2024, Salesforce, Inc. and its licensors</Copyright>
Expand Down
2 changes: 2 additions & 0 deletions Migration SDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{92044843-B4D7-4062-B1D5-DE7596072E33}"
ProjectSection(SolutionItems) = preProject
scripts\generate-docs.ps1 = scripts\generate-docs.ps1
scripts\sync-release-settings.json = scripts\sync-release-settings.json
scripts\sync-release.ps1 = scripts\sync-release.ps1
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DependencyInjection.ExampleApplication", "examples\DependencyInjection.ExampleApplication\DependencyInjection.ExampleApplication.csproj", "{99DA12FB-BB16-4EE1-9C9C-047755210255}"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ The Tableau Migration SDK is a client library to build an application to facilit
Quickstart:
- Install a [.NET Runtime](https://dotnet.microsoft.com/en-us/download).
- For Python install using PIP:
- [PIP CLI](https://pip.pypa.io/en/stable/cli/pip_install): `pip install tableau-migration`
- [PIP CLI](https://pip.pypa.io/en/stable/cli/pip_install): `pip install tableau_migration`
- For C# install using NuGet:
- [dotnet CLI](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-using-the-dotnet-cli): `dotnet add package Tableau.Migration --version 1.0.0`
- [dotnet CLI](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-using-the-dotnet-cli): `dotnet add package Tableau.Migration`
- [Nuget Package Manager](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio): Search for `Tableau.Migration`.
- Then check out our [code samples](https://tableau.github.io/migration-sdk/samples/intro.html).
- Then check out our [code samples](https://tableau.github.io/migration-sdk/samples/index.html).

To look at source code and delve deeper, first clone the repo:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<!-- Don't warn on ConfigureAwait on console application, Don't require license headers for sample code -->
<NoWarn>CA2007,IDE0073</NoWarn>
<UserSecretsId>7d7631f1-dc4a-49de-89d5-a194544705c1</UserSecretsId>
<UserSecretsId>8368baab-103b-45f6-bfb1-f89a537f4f3c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Tableau.Migration/Tableau.Migration.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EncryptExtractsTransformer<T> : ContentTransformerBase<T> where T :
{
private readonly ILogger<IContentTransformer<T>>? _logger;

public EncryptExtractsTransformer(ISharedResourcesLocalizer? localizer, ILogger<IContentTransformer<T>>? logger) : base(localizer, logger)
public EncryptExtractsTransformer(ISharedResourcesLocalizer localizer, ILogger<IContentTransformer<T>> logger) : base(localizer, logger)
{
_logger = logger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MigratedTagTransformer<T> : ContentTransformerBase<T> where T : ICo
{
private readonly ILogger<IContentTransformer<T>>? _logger;

public MigratedTagTransformer(ISharedResourcesLocalizer? localizer, ILogger<IContentTransformer<T>>? logger) : base(localizer, logger)
public MigratedTagTransformer(ISharedResourcesLocalizer localizer, ILogger<IContentTransformer<T>> logger) : base(localizer, logger)
{
_logger = logger;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Tableau.Migration.Content.Schedules;
using Tableau.Migration.Content.Schedules.Cloud;
using Tableau.Migration.Engine.Hooks.Transformers;
using Tableau.Migration.Resources;

namespace Csharp.ExampleApplication.Hooks.Transformers
{
#region class
public class SimpleScheduleStartAtTransformer<T>
: ContentTransformerBase<T>
where T : IWithSchedule<ICloudSchedule>
{
private readonly ILogger<IContentTransformer<T>>? _logger;

public SimpleScheduleStartAtTransformer(
ISharedResourcesLocalizer localizer,
ILogger<IContentTransformer<T>> logger)
: base(
localizer,
logger)
{
_logger = logger;
}

public override async Task<T?> TransformAsync(
T itemToTransform,
CancellationToken cancel)
{
// In this example, the `Start At` time is in the UTC time zone.
if (itemToTransform.Schedule.FrequencyDetails.StartAt is not null)
{
// A simple conversion to the EDT time zone.
var updatedStartAt = itemToTransform.Schedule.FrequencyDetails.StartAt.Value.AddHours(-4);

_logger?.LogInformation(
@"Adjusting the 'Start At' from {previousStartAt} to {updatedStartAt}.",
itemToTransform.Schedule.FrequencyDetails.StartAt.Value,
updatedStartAt);

itemToTransform.Schedule.FrequencyDetails.StartAt = updatedStartAt;
}

return await Task.FromResult(itemToTransform);
}
}
#endregion
}
6 changes: 6 additions & 0 deletions examples/Csharp.ExampleApplication/MyMigrationApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.Extensions.Options;
using Tableau.Migration;
using Tableau.Migration.Content;
using Tableau.Migration.Content.Schedules.Cloud;
using Tableau.Migration.Engine.Pipelines;

#region namespace
Expand Down Expand Up @@ -120,6 +121,10 @@ public async Task StartAsync(CancellationToken cancel)
_planBuilder.Transformers.Add<EncryptExtractsTransformer<IPublishableWorkbook>, IPublishableWorkbook>();
#endregion

#region StartAtTransformer-Registration
_planBuilder.Transformers.Add<SimpleScheduleStartAtTransformer<ICloudExtractRefreshTask>, ICloudExtractRefreshTask>();
#endregion

// Add migration action completed hooks
#region LogMigrationActionsHook-Registration
_planBuilder.Hooks.Add<LogMigrationActionsHook>();
Expand All @@ -131,6 +136,7 @@ public async Task StartAsync(CancellationToken cancel)
_planBuilder.Hooks.Add<LogMigrationBatchesHook<IProject>>();
_planBuilder.Hooks.Add<LogMigrationBatchesHook<IDataSource>>();
_planBuilder.Hooks.Add<LogMigrationBatchesHook<IWorkbook>>();
_planBuilder.Hooks.Add<LogMigrationBatchesHook<ICloudExtractRefreshTask>>();
#endregion

// Build the plan
Expand Down
4 changes: 4 additions & 0 deletions examples/Csharp.ExampleApplication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public static IServiceCollection AddCustomizations(this IServiceCollection servi
services.AddScoped<EncryptExtractsTransformer<IPublishableWorkbook>>();
#endregion

#region StartAtTransformer-DI
services.AddScoped(typeof(SimpleScheduleStartAtTransformer<>));
#endregion

#region LogMigrationActionsHook-DI
services.AddScoped<LogMigrationActionsHook>();
#endregion
Expand Down
4 changes: 4 additions & 0 deletions examples/Csharp.ExampleApplication/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
{
"type": "workbook",
"batchSize": 90
},
{
"type": "serverextractrefreshtask",
"batchSize": 100
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def map(self, ctx: ContentMappingContext[IUser]) -> ContentMappingContext[IUser]
_tableau_user_domain = ctx.mapped_location.parent()

# Re-use an existing email if it already exists.
if not ctx.content_item.email:
if ctx.content_item.email:
return ctx.map_to(_tableau_user_domain.append(ctx.content_item.email))

# Takes the existing username and appends the domain to build the email
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from datetime import time
from tableau_migration import (
ContentTransformerBase,
ICloudExtractRefreshTask
)

class SimpleScheduleStartAtTransformer(ContentTransformerBase[ICloudExtractRefreshTask]):
def transform(self, itemToTransform: ICloudExtractRefreshTask) -> ICloudExtractRefreshTask:
# In this example, the `Start At` time is in the UTC time zone.
if itemToTransform.schedule.frequency_details.start_at:
prev_start_at = itemToTransform.schedule.frequency_details.start_at
# A simple conversion to the EDT time zone.
itemToTransform.schedule.frequency_details.start_at = time(prev_start_at.hour - 4, prev_start_at.minute, prev_start_at.second, prev_start_at.microsecond);

return itemToTransform
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Compile Include="hooks\post_publish\bulk_logging_hook.py" />
<Compile Include="hooks\transformers\encrypt_extracts_transformer.py" />
<Compile Include="hooks\transformers\migrated_tag_transformer.py" />
<Compile Include="Hooks\transformers\schedule_startat_transformer.py" />
<Compile Include="print_result.py" />
<Compile Include="Python.ExampleApplication.py" />
</ItemGroup>
Expand Down
11 changes: 4 additions & 7 deletions examples/Python.ExampleApplication/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
--index-url https://artifactory.prod.tableautools.com/artifactory/api/pypi/tabpypi/simple
--pre
pip==24.0.0
setuptools==69.1.0
configparser==6.0.0
setuptools==70.1.1
configparser==7.0.0
tableau_migration
cffi==1.16.0
pycparser==2.21
pycparser==2.22
pythonnet==3.0.3
typing_extensions==4.9.0
typing_extensions==4.12.2
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.201",
"version": "8.0.302",
"rollForward": "latestMajor"
}
}
10 changes: 5 additions & 5 deletions scripts/generate-docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ $main_docs_dir = Join-Path $root_dir "src/Documentation"
$sphinx_output_dir = Join-Path $python_dir "Documentation/generated"

# Directory for Python wrapper files. Includes an index file and a directory for autogenerated files.
$python_wrapper_dir = Join-Path $main_docs_dir "api-python";
$python_apiref_dir = Join-Path $main_docs_dir "api-python";

$python_reference_dir_name = "reference";

# Directory where DocFX looks for markdown files to render into our 'Python Wrapper' section.
$python_md_destination = Join-Path $python_wrapper_dir $python_reference_dir_name;
$python_md_destination = Join-Path $python_apiref_dir $python_reference_dir_name;

function Run-Command {
param([string]$Cmd)
Expand Down Expand Up @@ -152,7 +152,7 @@ function Write-Python-docs {
Run-Command ("python -m pip install -q --upgrade pip");
Run-Command ("python -m pip install -q hatch");
Run-Command ("Clear-Directory -Path $sphinx_output_dir");
Run-Command ("python -m hatch run docs:sphinx-build -M markdown $sphinx_build_dir $sphinx_output_dir -q");
Run-Command ("python -m hatch run docs:sphinx-build -M markdown $sphinx_build_dir $sphinx_output_dir -Q");
Run-Command ("Pop-Location");
Write-Host-With-Timestamp "Finished: Generating python docs.";

Expand Down Expand Up @@ -269,7 +269,7 @@ function Write-Python-Docs-Toc {
}
}

$tocPath = Join-Path -Path $python_wrapper_dir -ChildPath toc.yml;
$tocPath = Join-Path -Path $python_apiref_dir -ChildPath toc.yml;

Run-Command ("Out-File -FilePath '$tocPath' -InputObject '$($fileContent | Out-String)'");

Expand All @@ -290,7 +290,7 @@ function Write-Final-Docs {

# Docfx related paths
$docfx_config_path = Join-Path $main_docs_dir "docfx.json";
$docfx_cmd = "dotnet docfx $docfx_config_path -t statictoc,templates\tableau --logLevel warning";
$docfx_cmd = "dotnet docfx $docfx_config_path -t default,statictoc,templates\tableau --logLevel warning";

# Run the docfx command to generate the final output
if ($Serve) {
Expand Down
1 change: 0 additions & 1 deletion src/Documentation/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
/**/packages/
/**/bin/
/**/obj/
_site
migration_sdk_metadata.json
4 changes: 2 additions & 2 deletions src/Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Content in Tab 3
##### Using regions (Preferred method)

```markdown
[!code-csharp[CS](../../../../examples/Csharp.ExampleApplication/MyMigrationApplication.cs#DefaultProjectsFilter-Registration)]
[!code-csharp[](../../../../examples/Csharp.ExampleApplication/MyMigrationApplication.cs#DefaultProjectsFilter-Registration)]
```

##### Using line numbers
Expand All @@ -157,7 +157,7 @@ Content in Tab 3
> Use these very sparingly for C#. When the code is edited, it can change line numbers and mess up code snippets.
```markdown
[!code-csharp[CS](../../../../examples/Csharp.ExampleApplication/Hooks/Mappings/EmailDomainMapping.cs#L8-)]
[!code-csharp[](../../../../examples/Csharp.ExampleApplication/Hooks/Mappings/EmailDomainMapping.cs#L8-)]
```

> [!IMPORTANT]
Expand Down
14 changes: 7 additions & 7 deletions src/Documentation/api-csharp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ Welcome to the C# API Reference for the Migration SDK.

## Examples to get started

The following code samples are for writing a simple migration app using the Migration SDK. For details on configuring and customizing the Migration SDK to your specific needs, see [Articles](~/articles/intro.md) and [Code Samples](~/samples/intro.md).
The following code samples are for writing a simple migration app using the Migration SDK. For details on configuring and customizing the Migration SDK to your specific needs, see [Articles](~/articles/index.md) and [Code Samples](~/samples/index.md).

### [Program.cs](#tab/program-cs)

[!code-csharp[CS](../../../examples/Csharp.ExampleApplication/Program.cs#namespace)]
[!code-csharp[](../../../examples/Csharp.ExampleApplication/Program.cs#namespace)]

### [Startup code](#tab/startup-cde)

[!code-csharp[CS](../../../examples/Csharp.ExampleApplication/MyMigrationApplication.cs#namespace)]
[!code-csharp[](../../../examples/Csharp.ExampleApplication/MyMigrationApplication.cs#namespace)]

### [Config classes](#tab/config-classes)

[!code-csharp[CS](../../../examples/Csharp.ExampleApplication/Config/MyMigrationApplicationOptions.cs#namespace)]
[!code-csharp[](../../../examples/Csharp.ExampleApplication/Config/MyMigrationApplicationOptions.cs#namespace)]

[!code-csharp[CS](../../../examples/Csharp.ExampleApplication/Config/EndpointOptions.cs#namespace)]
[!code-csharp[](../../../examples/Csharp.ExampleApplication/Config/EndpointOptions.cs#namespace)]

### [Config file](#tab/appsettings)

Expand All @@ -43,5 +43,5 @@ The following code samples are for writing a simple migration app using the Migr

## Suggested Reading

- [Code Samples](~/samples/intro.md)
- [Articles](~/articles/intro.md)
- [Code Samples](~/samples/index.md)
- [Articles](~/articles/index.md)
2 changes: 1 addition & 1 deletion src/Documentation/api-python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There are advanced features of the Migration SDK that the Python Wrapper cannot

## Examples to get started

The following code samples are for writing a simple migration app using the Migration SDK. For details on configuring and customizing the Migration SDK to your specific needs, see [Articles](~/articles/intro.md) and [Code Samples](~/samples/intro.md).
The following code samples are for writing a simple migration app using the Migration SDK. For details on configuring and customizing the Migration SDK to your specific needs, see [Articles](~/articles/index.md) and [Code Samples](~/samples/index.md).

### [Startup Script](#tab/startup)

Expand Down
Loading

0 comments on commit a1d6836

Please sign in to comment.