cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create a custom Python connector?

benmi
8 - Cloud Apps
8 - Cloud Apps

I was wondering if there's a way to create additional connectors using Python?

We are able to create custom code Python scripts that can for example retrieve data from an API. This works great, but using the custom code approach has some problems:

1. Errors with the arguments passed to the script only appear when the cube is being build, instead of when adding the table to the cube.

2. There's no preview of the data being returned by the Python script.

3. We can pass passwords through as arguments, but the passwords are then visible to other users.

4. Only one table can be returned, instead of all the possible tables for a base endpoint.

Of course we can use the Generic JDBC connector and the CData REST connector as well, however it would be nice to create connectors for the specific APIs we want to connect to, so that all the required input fields needed to set up the connection can be defined and seen right away, without having to put together a connection string for which the user has to download the CData driver. (Like we did in the attached image)

Is there a way of creating a connector with Python? Or is it only possible by creating a JDBC driver?

3 REPLIES 3

hkrtrainings408
7 - Data Storage
7 - Data Storage

reate a new Connector for HQ using Python course. Connectors are required to connect to content repositories to extract fields, metadata and other pieces of information. This example will connect to a file folder and extract information from CSV files. Each row in a CSV file will be an entry in the index. In addition, this example will show how to create one-to-many relationships where the CSV file entry will be linked to each row entry

Thanks.

johnsonit
7 - Data Storage
7 - Data Storage

Hello Buddy,

Yes, you can create additional connectors using Python in Anaplan! While creating custom code scripts has its drawbacks, as you mentioned, Python offers a powerful and flexible approach for building tailored connectors. Here's how you can address your concerns with a Python connector.

Assuming you have the capability to extend connectors using Python Support, here's a simplified example of how you might create a custom connector class in Python. Note that this is a generic example, and you would need to adapt it to the specifics of your tool's API:

Find the code:

class CustomAPIDataConnector:
def __init__(self, api_endpoint, api_key):
self.api_endpoint = api_endpoint
self.api_key = api_key

def fetch_data(self):
# Implement logic to retrieve data from the API using self.api_endpoint and self.api_key
# Return the fetched data

# Example usage
api_connector = CustomAPIDataConnector(api_endpoint='https://api.example.com/data', api_key='your_api_key')
data = api_connector.fetch_data()
print(data)

Also, check/refer to your tool's documentation or support resources to understand how custom connectors can be integrated.