question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error applying schema

See original GitHub issue

Not 100% sure what’s causing this issue, I’m assuming it’s an issue with psycopg2 version maybe?

When attempting to apply schema I get the following error:

$ procrastinate schema
Applying schema
Error: dict is not a sequence

Procrastinate file:

import os
import procrastinate as procrastinate_module

procrastinate = procrastinate_module.App(
    connector=procrastinate_module.Psycopg2Connector(**{
        'user': 'app',
        'password': 'password',
        'dbname': 'app',
        'host': os.environ['DATABASE_HOST'], # Uses Node IP
        'port': os.environ['DATABASE_PORT'], # Uses assigned NodePort
    })
)

Tried with psycopg2 2.8.6 and 2.9; procrastinate 0.19.0, Python 3.9.5. Digging into the issue with a stacktrace I found that changing psycopg2_connector.py:204 fixes it (though my solution seems more like a kludge then a fix): From:

cursor.execute(query, self._wrap_json(arguments))

To:

cursor.execute(query, self._wrap_json(arguments) or None)

Any ideas why this might be happening? Seems like a version mismatch is the most likely issue; maybe I could test a known good set of versions to rule that out?

Though I don’t think it’s relevant, for reproducibility I’m currently using PostgreSQL 12 DB, here’s the exact manifest I used to create it in K8s:

---
apiVersion: v1
kind: Pod
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  containers:
    - name: postgres
      image: postgres:12
      env:
        - name: POSTGRES_DB
          value: app
        - name: POSTGRES_USER
          value: app
        - name: POSTGRES_PASSWORD
          value: password
      ports:
        - containerPort: 5432
          name: postgresdb
      readinessProbe:
        exec:
          command: ["bash", "-c", "psql -U$POSTGRES_USER -d$POSTGRES_DB -c 'SELECT 1'"]
        initialDelaySeconds: 3
        timeoutSeconds: 20
      livenessProbe:
        exec:
          command: ["bash", "-c", "psql -U$POSTGRES_USER -d$POSTGRES_DB -c 'SELECT 1'"]
        initialDelaySeconds: 3
        timeoutSeconds: 20
---
apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  type: NodePort
  selector:
    app: postgres
  ports:
  - protocol: TCP
    port: 5432
    targetPort: postgresdb

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ewjoachimcommented, Jul 7, 2021

(I know it’s been a while, just wanted to let you know that this still is on my to-do list)

1reaction
elemoinecommented, Aug 2, 2021

Thanks @ioben and @ulfet for the bug report. And @ewjoachim for the fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error applying schema snapshot from SQLite to Postgres
Describe the Bug When trying to apply a schema snapshot from SQLite to Postgres with the following command npx directus schema apply -y...
Read more >
Problem applying schema changes in database to project
I have done a schema compare of the database to the project and selected the objects to update the project. However, when applying...
Read more >
RabbitMq Metricbeat error in logs - Beats - Elastic Discuss
With Metricbeat 7.8 and RabbitMq 3.8.1 I am getting errors in metricbeat.log: 2020-07-16T13:46:46.712+0200 ERROR [rabbitmq.queue] ...
Read more >
Basic SpringBoot application throwing schema validation error
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [id] in table ...
Read more >
The application is not licensed to modify or create schema for ...
This error can be caused by using a lower level ArcGIS Desktop license, such as ArcView (or ArcGIS 10.1 for Desktop Basic). This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found