Skip to content

Latest commit

 

History

History
366 lines (259 loc) · 13.1 KB

File metadata and controls

366 lines (259 loc) · 13.1 KB

FileImport

Method HTTP request Release Stage
create POST /v2/connectivity/connections/{connectionRid}/fileImports Stable
delete DELETE /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid} Stable
execute POST /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid}/execute Stable
get GET /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid} Stable
list GET /v2/connectivity/connections/{connectionRid}/fileImports Stable
replace PUT /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid} Stable

create

Creates a new FileImport.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
dataset_rid DatasetRid The RID of the output dataset. Can not be modified after the file import is created.
display_name FileImportDisplayName
file_import_filters List[FileImportFilter] Use filters to limit which files should be imported. Filters are applied in the order they are defined. A different ordering of filters may lead to a more optimized import. Learn more about optimizing file imports.
import_mode FileImportMode
branch_name Optional[BranchName] The branch name in the output dataset that will contain the imported data. Defaults to master for most enrollments. Can not be modified after the file import is created. [optional]
subfolder Optional[str] A subfolder in the external system that will be imported. If not specified, defaults to the root folder of the external system. [optional]

Return type

FileImport

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# DatasetRid | The RID of the output dataset. Can not be modified after the file import is created.
dataset_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da"
# FileImportDisplayName
display_name = "My file import"
# List[FileImportFilter] | Use filters to limit which files should be imported. Filters are applied in the order they are defined. A different ordering of filters may lead to a more optimized import. [Learn more about optimizing file imports.](https://palantir.com/docs/foundry/data-connection/file-based-syncs/#optimize-file-based-syncs)
file_import_filters = [{"type": "pathMatchesFilter", "regex": "my-subfolder"}]
# FileImportMode
import_mode = "SNAPSHOT"
# Optional[BranchName] | The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the file import is created.
branch_name = "master"
# Optional[str] | A subfolder in the external system that will be imported. If not specified, defaults to the root folder of the external system.
subfolder = "subfolder1/subfolder2"


try:
    api_response = client.connectivity.Connection.FileImport.create(
        connection_rid,
        dataset_rid=dataset_rid,
        display_name=display_name,
        file_import_filters=file_import_filters,
        import_mode=import_mode,
        branch_name=branch_name,
        subfolder=subfolder,
    )
    print("The create response:\n")
    pprint(api_response)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.create: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
200 FileImport The created FileImport application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete

Delete the FileImport with the specified RID. Deleting the file import does not delete the destination dataset but the dataset will no longer be updated by this import.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
file_import_rid FileImportRid

Return type

None

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# FileImportRid
file_import_rid = None


try:
    api_response = client.connectivity.Connection.FileImport.delete(connection_rid, file_import_rid)
    print("The delete response:\n")
    pprint(api_response)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.delete: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
204 None None

[Back to top] [Back to API list] [Back to Model list] [Back to README]

execute

Executes the FileImport, which runs asynchronously as a Foundry Build. The returned BuildRid can be used to check the status via the Orchestration API.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
file_import_rid FileImportRid

Return type

BuildRid

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# FileImportRid
file_import_rid = None


try:
    api_response = client.connectivity.Connection.FileImport.execute(
        connection_rid, file_import_rid
    )
    print("The execute response:\n")
    pprint(api_response)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.execute: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
200 BuildRid application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get

Get the FileImport with the specified rid.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
file_import_rid FileImportRid

Return type

FileImport

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# FileImportRid
file_import_rid = None


try:
    api_response = client.connectivity.Connection.FileImport.get(connection_rid, file_import_rid)
    print("The get response:\n")
    pprint(api_response)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.get: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
200 FileImport application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

Lists all file imports defined for this connection. Only file imports that the user has permissions to view will be returned.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
page_size Optional[PageSize] The page size to use for the endpoint. [optional]
page_token Optional[PageToken] The page token indicates where to start paging. This should be omitted from the first page's request. To fetch the next page, clients should take the value from the nextPageToken field of the previous response and use it to populate the pageToken field of the next request. [optional]

Return type

ListFileImportsResponse

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# Optional[PageSize] | The page size to use for the endpoint.
page_size = None
# Optional[PageToken] | The page token indicates where to start paging. This should be omitted from the first page's request. To fetch the next page, clients should take the value from the `nextPageToken` field of the previous response and use it to populate the `pageToken` field of the next request.
page_token = None


try:
    for file_import in client.connectivity.Connection.FileImport.list(
        connection_rid, page_size=page_size, page_token=page_token
    ):
        pprint(file_import)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.list: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
200 ListFileImportsResponse application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

replace

Replace the FileImport with the specified rid.

Parameters

Name Type Description Notes
connection_rid ConnectionRid
file_import_rid FileImportRid
display_name FileImportDisplayName
file_import_filters List[FileImportFilter] Use filters to limit which files should be imported. Filters are applied in the order they are defined. A different ordering of filters may lead to a more optimized import. Learn more about optimizing file imports.
import_mode FileImportMode
subfolder Optional[str] A subfolder in the external system that will be imported. If not specified, defaults to the root folder of the external system. [optional]

Return type

FileImport

Example

from foundry_sdk import FoundryClient
import foundry_sdk
from pprint import pprint

client = FoundryClient(auth=foundry_sdk.UserTokenAuth(...), hostname="example.palantirfoundry.com")

# ConnectionRid
connection_rid = None
# FileImportRid
file_import_rid = None
# FileImportDisplayName
display_name = "My file import"
# List[FileImportFilter] | Use filters to limit which files should be imported. Filters are applied in the order they are defined. A different ordering of filters may lead to a more optimized import. [Learn more about optimizing file imports.](https://palantir.com/docs/foundry/data-connection/file-based-syncs/#optimize-file-based-syncs)
file_import_filters = [{"type": "pathMatchesFilter", "regex": "my-subfolder"}]
# FileImportMode
import_mode = "SNAPSHOT"
# Optional[str] | A subfolder in the external system that will be imported. If not specified, defaults to the root folder of the external system.
subfolder = "subfolder1/subfolder2"


try:
    api_response = client.connectivity.Connection.FileImport.replace(
        connection_rid,
        file_import_rid,
        display_name=display_name,
        file_import_filters=file_import_filters,
        import_mode=import_mode,
        subfolder=subfolder,
    )
    print("The replace response:\n")
    pprint(api_response)
except foundry_sdk.PalantirRPCException as e:
    print("HTTP error when calling FileImport.replace: %s\n" % e)

Authorization

See README

HTTP response details

Status Code Type Description Content Type
200 FileImport The replaced FileImport application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]