Create a Connector
By creating a connector, you can connect to DBs and SaaS.
Connectors can be created in both cloud and local environments, but using those created in the cloud environment allows you to use them as-is after deployment.
Create a Connector
Create a connector from the “Connectors” tab on the dashboard.
Obtain Connection Name
Once created successfully, activate the use of the connector from the project details page and obtain the connection name.
Use Connector in SQL/Python
Use the connection name in SQL or Python files to utilize the connector.
For detailed connection methods, please refer to the section at the bottom of this page.{{
config(
connection="connection_name"
)
}}
select * from table_name;
If a connector with the same name is defined in both the local and cloud environments, the local environment’s connector will be used.After deploying to the cloud, only the connectors defined in the cloud environment are used.
Connect to DB
Create an SQL file to retrieve data. You can use the SQL syntax of the connected database by defining the connection name in the config function.
{{
config(
connection="connection_name"
)
}}
select * from table_name;
For information on connecting to different types of databases, please refer to the following.
Connect to SaaS
Morph provides integration with SaaS.
By using integration, you can focus on implementing business logic without having to implement authentication.
You can obtain the access_token from the integration created in Python as follows.
import pandas as pd
import morph
from morph import MorphGlobalContext
from morph_lib.api import get_auth_token
@morph.func
def get_salesforce_opportunities(context: MorphGlobalContext) -> pd.DataFrame:
access_token = get_auth_token("salesforce-connection-name")
# ↓↓↓ call API with access_token ↓↓↓
For information on connecting to different types of SaaS, please refer to the following.