Custom Python

Custom Python Connections work in the same way as Ascend's out-of-the-box connections. Python Read Connectors must pass through a Python Connection in order to access data stores. When creating a Python Connector, you first need to create a Python connection.

The Python connection can contain code and stored credential configurations that will be shared across many or all future Python Read connectors. As this implies, it is best to approach Python Connections strategically. Specifically, the volume of Python connections should reflect the access control patterns of your environment. However, a Python Read Connector can only be associated to a single Python Connection. Creating a Python Connection requires planning for creating a future Python Read Connector.

To leverage the power and flexibility of Python when accessing data in Ascend, two components are required, a Python Connection and a Python Connector.

A custom Python Connection can contain any code to be shared with a read connector. For example, integrating external key and secret management services into custom connection credentials provides seamless, managed access without the need for hard coding in credentials. Alternatively, key and secret management services can be integrated within each Python Read Connector's code. Your internal best practices in CI/CD structure should be taken into consideration accordingly.

Python Read Connectors are created using the same steps as other Ascend Read Connectors. However, there are a few configuration differences. Python Read Connectors require selections for a Connector Code Interface and a Code Fingerprint Strategy. Schema Generation also works differently. In a standard Read Connector, Schema Generation is effectively a limited query of the relevant table. Generating schema in a Python Read Connector will execute the code in the Connector and in the Python Connection, returning the full result set.

For complete descriptions of definitions, see each interface's reference page, linked below:

Key Considerations

When creating your Python Connection and Python Connector, keep the following in mind:

  • Python Connections and Connectors have a "one-to-many" relationship. A Connection can have multiple connectors but a Connector can only be associated with one Connection.
  • External credential management can be coded into either the Connection or the Connector, but, if possible, it's best to manage credentials within the Python Connection.
  • In addition to standard Read Connector selections, a Python Connection also requires the selection of a Code Interface and a Fingerprint Strategy.
  • Schema Generation will execute the code in your Connection and Connector and return the full set of data.