CockroachDB
Squid can connect to a CockroachDB database to serve as the data source for your Squid application.
CockroachDB is a cloud-native, distributed SQL database designed for scalability. With Squid, you can integrate with your CockroachDB database and even join data with other database connectors.
To integrate your CockroachDB database with Squid, complete the following steps:
- Open the Squid Console and select your application to use with CockroachDB.
- Click the Connectors tab, and then click Available connectors.
- Select the CockroachDB connector.
- Provide the following configuration information:
- Connector ID - Choose an ID that is brief and helps identify the connector.
- Database endpoint - The database host including the port number.
- CockroachDB username
- CockroachDB password - To keep it private, store your password in Squid Secrets.
- Schema - The name of the schema to connect to - If none is provided, the default
public
schema is used. - Database name - The name of the database to connect to.
- SSL configuration (if needed)
Once you've entered the connection information, click Test connection to confirm that the connection is configured properly.
Squid's IP address
To prevent denial-of-service attacks, brute force password attacks, and other forms of malicious activity, some providers recommend restricting your network to allow access only from specific IP addresses. This procedure is commonly known as allowlisting, and it limits access to your resources by only accepting connections from a specific list of endpoints.
Refer to your resource provider to determine if you need to add Squid's IP addresses to your access list. If allowlisting is required, you can find Squid's IP addresses on the application overview page of the Squid Console (located in the Cloud Provider section).
Check the Cockroach Labs documentation to learn how to add allowlisted IP addresses.
Securing your database
By default, security rules are required, and in a production environment, it's essential to never allow access to the connector without them. Learn more about securing your database data in the security rules documentation.
Datatype mapping
The following table outlines the datatype mapping between CockroachDB and Squid:
Postgresql Type | Squid Type |
---|---|
bigint | number |
bit | string |
bit varying | string |
boolean | boolean |
bytea | string |
char | string |
character | string |
character varying | string |
cidr | string |
date | date |
double precision | number |
enum | string |
inet | string |
integer | integer |
interval | string |
json | map or array |
jsonb | map or array |
macaddr | string |
macaddr8 | string |
mediumint | integer |
money | number |
numeric | number |
real | number |
smallint | integer |
text | string |
time | string |
time with time zone | string |
time without time zone | string |
timestamp | date |
timestamp with time zone | date |
timestamp without time zone | date |
tinyint | integer |
uuid | string |
varchar | string |
To learn how to work with CockroachDB data in Squid, view the Client SDK documentation.