我已经使用Data Pipeline将一些csv数据从S3加载到RDS中。我正在使用Postgres 10.6。我知道数据管道肯定会做一些写操作,因为我可以看到写入延迟,写入IOPS,队列深度等的相应增加。问题是我不知道它写的是什么,因为运行select count(*) from users
返回0。 Data Pipeline中没有错误或警告。
我正在使用psycopg2
运行查询:
conn = psycopg2.connect(
host=host,
port=5432,
user=username,
password=password,
connect_timeout=10,
database='postgres'
)
cursor = conn.cursor()
cursor.execute('select count(*) from users')
这是我的插入查询:
INSERT INTO users (id, gender, country_code)
VALUES (?, ?, ?)
ON CONFLICT (id)
DO UPDATE SET
gender = EXCLUDED.gender, country_code = EXCLUDED.country_code;
这是我的RDS数据库/数据节点的配置:
{
"*password": "#{*myRDSPassword}",
"name": "postgres",
"jdbcProperties": "allowMultiQueries=true",
"id": "rds_mysql",
"region": "us-west-1",
"type": "RdsDatabase",
"rdsInstanceId": "#{myRDSInstanceId}",
"username": "#{myRDSUsername}"
},
{
"database": {
"ref": "rds_mysql"
},
"name": "DestinationRDSTable",
"insertQuery": "#{myRDSTableInsertSql}",
"id": "DestinationRDSTable",
"type": "SqlDataNode",
"table": "#{myRDSTableName}",
"selectQuery": "select * from #{table}"
},
{
"myRDSTableName": "users",
}
我能想到的唯一解释是我写的是一个不同于我所查询的postgres
默认的数据库,但我不知道应该在哪里设置这个属性。有没有人有这个问题的经验?
作为参考,通过将可选参数databaseName="postgres"
添加到RdsDatabase对象来解决此问题。