Comments (5)
@malthe do you think you can release a new version, because it looks like the tag v1.8.1 is not including the latest changes in the SQL file the @retr0h is mentioning.
@retr0h, the tag v1.8.1 actually does not include the changes, so I think we should just release the master under v1.8.2 and it should solve the issue:
https://github.com/malthe/pq/blob/1.8.1/pq/create.sql
Thanks for being patient with us 🙇 🙈
from pq.
I have released 1.8.2. Sorry for the wait!
from pq.
Actually, this looks to be a problem with pip install in general.
[jodewey:~] % mkdir foo
[jodewey:~] % cd foo
[jodewey:~/foo] % virtualenv --no-site-packages .venv
Using base prefix '/Users/jodewey/.pyenv/versions/3.7.6'
New python executable in /Users/jodewey/foo/.venv/bin/python3.7
Also creating executable in /Users/jodewey/foo/.venv/bin/python
Installing setuptools, pip, wheel...
done.
[jodewey:~/foo] % source .venv/bin/activate
[jodewey:~/foo] % pip install pq
Processing /Users/jodewey/Library/Caches/pip/wheels/bb/9a/57/391012c0c104963cc3c6575f90af34d951eb5b123179bfe9c9/pq-1.8.1-py3-none-any.whl
Installing collected packages: pq
Successfully installed pq-1.8.1
[jodewey:~/foo] % find . -name "create.sql"
./.venv/lib/python3.7/site-packages/pq/create.sql
[jodewey:~/foo] % cat ./.venv/lib/python3.7/site-packages/pq/create.sql
do $$ begin
CREATE TABLE %(name)s (
id bigserial PRIMARY KEY,
enqueued_at timestamptz NOT NULL DEFAULT current_timestamp,
dequeued_at timestamptz,
expected_at timestamptz,
schedule_at timestamptz,
q_name text NOT NULL CHECK (length(q_name) > 0),
data json NOT NULL
);
end $$ language plpgsql;
create index priority_idx_%(name)s on %(name)s
(schedule_at nulls first, expected_at nulls first, q_name)
where dequeued_at is null
and q_name = '%(name)s';
create index priority_idx_no_%(name)s on %(name)s
(schedule_at nulls first, expected_at nulls first, q_name)
where dequeued_at is null
and q_name != '%(name)s';
drop function if exists pq_notify() cascade;
create function pq_notify() returns trigger as $$ begin
perform pg_notify(new.q_name, '');
return null;
end $$ language plpgsql;
create trigger pq_insert
after insert on %(name)s
for each row
execute procedure pq_notify();
from pq.
@retr0h, could you please help us understand what exactly is the issue here?
The error you're getting looks pretty straight-forward:
psycopg2.errors.DuplicateTable: relation "queue" already exists
I recently had to set up pq
with django and there's a simple way to work around this:
occrp/id-backend@0e0b5f9#diff-1066dd485a7c75c339cc3bd577b45328
from pq.
@stas The issue is the create.sql
file in the pypi package 1.8.1
, does not contain the same contents in the pq repo's master branch.
For some reason when the author tags the repo and creates a release, the create.sql
is not being updated.
create.sql
:
The file in master branch has conditions in the sql create table if not exists %(name)s
, where this schema file would be safe to run multiple times.
The error you're getting looks pretty straight-forward:
psycopg2.errors.DuplicateTable: relation "queue" already exists
I recently had to set up pq with django and there's a simple way to work around this:
occrp/id-backend@0e0b5f9#diff-1066dd485a7c75c339cc3bd577b45328
You are working around the very problem I am discussing in this issue.
from pq.
Related Issues (20)
- connection pool exhausted HOT 3
- DuplicatePreparedStatement error HOT 10
- Prepared statement name not properly escaped HOT 1
- Question: why am I seeing "NOTICE: function pq_notify does not exist" in the logs? HOT 3
- Delete executed tasks?! HOT 1
- Wait on a job? HOT 3
- get() timeout not honoured HOT 1
- Any interest in porting to cockroach HOT 3
- Get id of current task HOT 2
- Performance with a very large queue HOT 9
- lost trigger when setting up multiple queue-tables within the same schema
- Adding recurring tasks? HOT 4
- queue.put() inside a transaction sets enqueued_at to the transaction start time, not the current time HOT 4
- Adding name of the job producer HOT 2
- Dashboard for PQ HOT 3
- Any plans to migrate to Psycopg 3? HOT 1
- get items sometimes doesn't work
- 2.x roadmap
- Logging message not explicit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pq.