Comments (11)
I'm not sure if this is related, but this worked for me:
postgresql://[email protected]:5432/
e.g. add the username of the database and use the IP instead of hostname localhost
.
from stellar.
Has anyone else gotten this to work? I've tried a variety of URLs, including the full one postgresql://joshma@localhost:5432/mydb
and it won't work, while psql -h localhost -p 5432 -U joshma mydb
works fine.
from stellar.
I've faced the same error. After reading sqlalchemy's document a little I tried to pass postgresql+psycopg2://ubuntu:@/testdb?host=/var/run/postgresql
, but it asks me my db name again Please enter the name of the database (eg. projectdb):
and returns another error if I type the db name:
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/testdb/.s.PGSQL.5432"?`
The socket file should be at /var/run/postgresql/.s.PGSQL.5432.
database_exists
and other methods in stellar's code do not seem supporting additional params like specifying unix socket. After created a user with alter user newuser createdb
and allowed tcp access in pg_hba.conf, postgresql+psycopg2://newuser:newpass@localhost:5432/
is working in my case.
from stellar.
@ramonakira I tried what you suggested with no luck. Got the exact same error.
from stellar.
@nobuf 👍
postgresql+psycopg2://newuser:newpass@localhost:5432/
has worked for me too
from stellar.
The root of this problem is: https://github.com/fastmonkeys/stellar/blob/master/stellar/command.py#L160
If you print the OperationalError exception what you get most of the time is database does not exists
and that's due to the trailing slash that's added in the URL that contains the database name.
If the URL does not contain the database name, then it's like sqlalchemy tries to find the database having the same name as the user, so if you do not have a database named <user>
, it fails to connect as well.
I'll see if I can come up with a patch that keeps the original idea of the author while allowing to connect to a specific database.
from stellar.
@pypingou thanks for the patch, that worked for me
from stellar.
I am also having problems getting it to work with a database that requires authentication to work. I have tried various formats:
postgresql://user:pass@localhost:5432/
postgresql://user:pass@localhast:5432/dbname
postgresql+psycopg2://user:pass@localhost:5432/
postgresql+psycopg2://user:pass@localhost:5432/dbname
No matter what though I get the same error:
Could not connect to database: postgresql+psycopg2://user:pass@localhost:5432/dbname
Make sure database process is running and try again.
Please enter the url for your database.
The server is running and I am able to connect to it with the psql
command, and my app connects to it fine as well.
from stellar.
Can someone tell me what's going on here?
lects/postgresql/psycopg2.py", line 422, in dbapi
import psycopg2
File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
Reason: image not found
from stellar.
@glennmartinez you seem to be missing some libraries: libssl perhaps?
from stellar.
This was fixed by @pypingou's PR (thanks!).
from stellar.
Related Issues (20)
- Not working properly with docker HOT 4
- PostgreSQL 10 compatibility HOT 1
- postgresql 10.1 pg_stat_activity.procpid does not exist HOT 2
- Trying to get this working on a Mac HOT 2
- There is 1 other session using the database error HOT 15
- is it possible take snapshot from DB_A and transfer to DB_B to restore ? HOT 1
- How does this compare with putting the database under Git control? HOT 1
- "An error occurred while installing stellar!" HOT 2
- Disable forking for better Docker compatibility HOT 2
- ValueError: invalid literal for int() with base 10: '6beta1'
- Source database "template1" is being accessed by other users HOT 5
- Support creating a snapshot from a DB dump
- Synchronize db snapshots with git checkout
- suggestions - snapshot retension
- Is this project still active? HOT 8
- stellar GC: psycopg2.errors.DiskFull error after exiting 0 HOT 1
- restore fails - cannot drop the currently open database on PostgreSQL 10.1 HOT 7
- Add support for generated columns
- Improve documentation
- [SOLVED] Running Stellar + Docker HOT 1
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 stellar.