postgresql

Migrate postgres dump to RDS

依然范特西╮ 提交于 2021-02-07 08:09:21
问题 I have a Django postgres db (v9.3.10) running on digital ocean and am trying to migrate it over to Amazon RDS (postgres v 9.4.5). The RDS is a db.m3.xlarge instance with 300GB. I've dumped the Digital Ocean db with: sudo -u postgres pg_dump -Fc -o -f /home/<user>/db.sql <dbname> And now I'm trying to migrate it over with: pg_restore -h <RDS endpoint> --clean -Fc -v -d <dbname> -U <RDS master user> /home/<user>/db.sql The only error I see is: pg_restore: [archiver (db)] Error from TOC entry

Migrate postgres dump to RDS

我的未来我决定 提交于 2021-02-07 08:08:35
问题 I have a Django postgres db (v9.3.10) running on digital ocean and am trying to migrate it over to Amazon RDS (postgres v 9.4.5). The RDS is a db.m3.xlarge instance with 300GB. I've dumped the Digital Ocean db with: sudo -u postgres pg_dump -Fc -o -f /home/<user>/db.sql <dbname> And now I'm trying to migrate it over with: pg_restore -h <RDS endpoint> --clean -Fc -v -d <dbname> -U <RDS master user> /home/<user>/db.sql The only error I see is: pg_restore: [archiver (db)] Error from TOC entry

Migrate postgres dump to RDS

六眼飞鱼酱① 提交于 2021-02-07 08:04:27
问题 I have a Django postgres db (v9.3.10) running on digital ocean and am trying to migrate it over to Amazon RDS (postgres v 9.4.5). The RDS is a db.m3.xlarge instance with 300GB. I've dumped the Digital Ocean db with: sudo -u postgres pg_dump -Fc -o -f /home/<user>/db.sql <dbname> And now I'm trying to migrate it over with: pg_restore -h <RDS endpoint> --clean -Fc -v -d <dbname> -U <RDS master user> /home/<user>/db.sql The only error I see is: pg_restore: [archiver (db)] Error from TOC entry

sqlalchemy with postgres: insert into a table whose columns have parentheses

时光总嘲笑我的痴心妄想 提交于 2021-02-07 08:01:36
问题 Suppose you have a table "foo" in postgres with column name "col (parens) name" . The psql command INSERT INTO "foo" ("col (parens) name") VALUES ('bar'); works just fine. However, if I try to do the same using sqlalchemy (version 0.9.7), the resulting python code fails: conn = sqlalchemy.create_engine('postgresql://name:password@host:port/database') meta = sqlalchemy.schema.MetaData() meta.reflect(bind=conn) foo = meta.tables['foo'] vals = [{'col (parens) name': 'hi'}, {'col (parens) name':

Driver:org.postgresql.Driver@3ed03652 returned null for URL… While deployin spring boot to Heroku

谁说胖子不能爱 提交于 2021-02-07 07:53:40
问题 I try deploy my application on Heroku, but have some errors which I can't fix my application.poperties spring.mvc.view.prefix = /WEB-INF/view/ spring.mvc.view.suffix = .jsp spring.datasource.url = jdbc:postgres://user:pass@ec2-54-247-166-129.eu-west-1.compute.amazonaws.com:5432/database # Username and password spring.datasource.username = user spring.datasource.password = pass # Keep the connection alive if idle for a long time (needed in production) spring.datasource.testWhileIdle = true

order_by on Many-to-Many field results in duplicate entries in queryset

帅比萌擦擦* 提交于 2021-02-07 07:21:59
问题 I am attempting to perform an order_by based a m2m field, but it ends up creating duplicate entries in my queryset. I have been searching through the django documentation and related questions on stack exchange, but I haven't been able to come up with any solutions. Models: class WorkOrder(models.Model): ... appointment = models.ManyToManyField(Appointment, null=True, blank=True, related_name = 'appointment_from_schedule') ... class Appointment(models.Model): title = models.CharField(max

postgres with docker compose gives FATAL: role “root” does not exist error

落花浮王杯 提交于 2021-02-07 06:25:26
问题 I'm trying to create a simple demo with postgres on a local windows machine with docker desktop. This is my yaml docker compose file named img.yaml : version: '3.6' services: postgres-demo: image: postgres:11.5-alpine container_name: postgres-demo environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=Welcome - POSTGRES_DB=conference_app healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s timeout: 5s retries: 5 ports: - 5432:5432 volumes: - .:/var/lib/my_data restart:

SQL Error: 0, SQLState: 08006

回眸只為那壹抹淺笑 提交于 2021-02-07 05:32:24
问题 I have a web application with hibernate connection. application is connecting to PostgreSQL db. Some times I am getting below exceptions in my logs. Caused by: **org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.** at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags

SQL Error: 0, SQLState: 08006

馋奶兔 提交于 2021-02-07 05:32:09
问题 I have a web application with hibernate connection. application is connecting to PostgreSQL db. Some times I am getting below exceptions in my logs. Caused by: **org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.** at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags

Connect pyodbc to Postgres

早过忘川 提交于 2021-02-07 04:58:06
问题 Trying to connect to Postgres using pyodbc. I can connect to the DB with isql: echo "select 1" | isql -v my-connector Returns: +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> select 1 +------------+ | ?column? | +------------+ | 1 | +------------+ SQLRowCount returns 1 1 rows fetched But when I try to connect with pyodbc: import pyodbc con = pyodbc.connect("DRIVER={PostgreSQL