Redshift
Connecting to Redshift
For an overview of the connector, please refer to the following link:
Create a Connector
Select the “Connectors” tab on the top page and press the “Create” button.
Enter Redshift Credentials
Enter the credentials for the database you want to connect to in the displayed form. If connecting via a remote server, check the “SSH” box and fill in the necessary fields.
After entering the information, press the Create button to complete the creation. If there are any errors in the parameters, an error message will be displayed, so please check the connection details again.
Field Name | Description | Required | Example |
---|---|---|---|
Host | Enter the database host name. | ✅ | example.com |
Port | Enter the database connection port. | ✅ | 5439 |
Database | Enter the database name. | ✅ | my_database |
Username | Enter the database username. | ✅ | db_user |
Password | Enter the database user password. | ✅ | mypassword |
SSH | Specify if using SSH connection. | ||
SSH Host | Enter the remote server host name. | ssh.example.com | |
SSH Port | Enter the remote server connection port. | 22 | |
SSH Username | Enter the remote server username. | ssh_user | |
SSH Password | Enter the remote server user password. | sshpassword | |
SSH Private Key | Enter the remote server private key. | -----BEGIN RSA PRIVATE KEY----- | |
SSH Passphrase | Enter the passphrase for the private key. | my_passphrase |
54.150.149.0/32
in the IP whitelist of the target database.Connect to the Created Database
Once created successfully, you can get the connector name from the list display. The string next to the icon is connection_name
. You can use this to connect to the database in your code.
Enter the created connector name in your SQL or Python code to retrieve data.
Create a Connector
Select the “Connectors” tab on the top page and press the “Create” button.
Enter Redshift Credentials
Enter the credentials for the database you want to connect to in the displayed form. If connecting via a remote server, check the “SSH” box and fill in the necessary fields.
After entering the information, press the Create button to complete the creation. If there are any errors in the parameters, an error message will be displayed, so please check the connection details again.
Field Name | Description | Required | Example |
---|---|---|---|
Host | Enter the database host name. | ✅ | example.com |
Port | Enter the database connection port. | ✅ | 5439 |
Database | Enter the database name. | ✅ | my_database |
Username | Enter the database username. | ✅ | db_user |
Password | Enter the database user password. | ✅ | mypassword |
SSH | Specify if using SSH connection. | ||
SSH Host | Enter the remote server host name. | ssh.example.com | |
SSH Port | Enter the remote server connection port. | 22 | |
SSH Username | Enter the remote server username. | ssh_user | |
SSH Password | Enter the remote server user password. | sshpassword | |
SSH Private Key | Enter the remote server private key. | -----BEGIN RSA PRIVATE KEY----- | |
SSH Passphrase | Enter the passphrase for the private key. | my_passphrase |
54.150.149.0/32
in the IP whitelist of the target database.Connect to the Created Database
Once created successfully, you can get the connector name from the list display. The string next to the icon is connection_name
. You can use this to connect to the database in your code.
Enter the created connector name in your SQL or Python code to retrieve data.
Run the morph init Command
Run the morph init
command to save the DB connection information in ~/.morph/connections.yml
.
If you have not installed the morph package, please install it with the following command before proceeding.
A list of database types will be displayed in the interactive interface, so select Redshift.
Next, enter the database credentials. slug
is treated as the connector name, which you specify in SQL or Python.
Replace the following input examples with actual values that can connect.
Once the credentials are saved, the following message will be displayed.
connections.yml
is saved as follows. If you create other connectors, they will be added under connections
.
Retrieve Data Using the Connector in Code
Enter the created connector name in your SQL or Python code to retrieve data.
When actually specifying the connector and executing the file, the priority is as follows.
Also, please note that only connectors created in the dashboard can be used in the environment where morph deploy
is performed.
- Connectors listed in
~/.morph/connections.yml
on the local machine - Connectors registered in the cloud