I had my all databases stored at a location C:\JATIN DATA\database\neo4jDatabases. How can I take the dump of all databases individually using neo4j Dekstop.
I had already tried neo4j-admin dump --database= --to= this command but getting errors like Neo.ClientError.Statement.SyntaxError: Invalid input 'n': expected (line 1, column 1 (offset: 0))
"neo4j-admin dump --database= --to="
^
neo4j-admin must be run from a terminal command line -- not from the neo4j Browser.
Since you are using the Desktop, you can open a terminal window to the appropriate directory by selecting your neo4j Project from the Projects panel on the left, click the Manage button of the database you want to dump, And then select the Terminal tab.
Once in the Terminal window, you can enter a command like the one suggested by #logisma:
bin/neo4j-admin dump --database=graph.db --to=c:\
Thanks #cybersam and #logisima finally dump is taken successfully. This is the complete command .\bin\neo4j-admin.bat dump --database=graph.db --to=c:\dump\article_citation_graph.dump there was some admin privilege error.
Have you try this : .\bin\neo4j-admin.bat dump --database=graph.db --to=c:\
This should create a file named graph.db.dump in your c:\ folder.
Related
Installing neo4j at arch with yay -S neo4j-community and starting with systemctl start neo4j I open http://localhost:7474/browser/ and execute the demo command create database movies but I get the error
Neo.ClientError.Statement.NotSystemDatabaseError
Unsupported administration command: CREATE DATABASE movies
because of desperation I tried to remove neo4j completely but he still "remembers" my initial password and also still has a reference to graph.db that I have removed manually in the menubar.
Where are the files neo4j stores and does someone have idea to fix the problem with the database creation?
I have installed all prerequisites for setting up the hyperledger Explorer but when I start it, I got the following error in log file:
And my config.json file is this:
Postgres' command also done:
1: https://i.stack.imgur.com/eTpSY.png
2: https://i.stack.imgur.com/IocQU.png
You're database setup is not done correctly, run these commands one by one.
Database setup
Connect to PostgreSQL database
sudo -u postgres psql
Run create database script
\i app/db/explorerpg.sql
\i app/db/updatepg.sql
Run db status commands.
\l view created fabricexplorer database
\d view created tables
Actually it postgres database error ...
In your error its clearly said that the chaincode_id doesnt exit ... so this is the problem .
if you want check what column are existed in the transaction table just follow below step
cd blockchain-explorer/app/persistence/postgreSQL/db
sudo -u postgres psql
\d transactions
check the corresponding column chaincode_id exist or not (it wont exist now ,Thats why you got this error)....
Solution for this type error
If you got any error like this first just go to the blockchain-explorer/app/persistence/postgreSQL/db directory
There you can see two file explorerpg.sql and updatepg.sql open this two file and check the corresponding column if existed on any of this file or not. If not you better to download explorer another version which contain the corresponding columns either of this two file mentioned above.
if existed just run below command on ubuntu
cd blockchain-explorer/app/persistence/postgreSQL/db
sudo -u postgres psql
\i explorerpg.sql
\i updatepg.sql
Once done this command just check the column "chaincode_id " is created or not by
\d transactions
it will list all column just check it on.
if the chaincode_id is exist run the explorer again ....
I have generated a cypher file and want to load it into neo4j.
The only relevant documentation I could find was about loading csv's.
I also tried the shell but it seems to have no effect
cypher-shell.bat -uneo4j -pne04j < db.cql
Copy paste into localhost:7474/browser makes the browser unresponsive.
In the current Neo4j version you can use Cypher Shell to achieve your goal.
From the docs, Invoke Cypher Shell with a Cypher script from the command line:
$ cat db.cql | bin/cypher-shell -u yourneo4juser -p yourpassword
Note that this example is based in a Linux instalation. If you are using Neo4j with Windows, you will need to adjust this command to your needs.
Not sure when this has been added but in the current version (4.4) an alternative way to load a cypher file to NEO4J (GUI) is by dragging and dropping the cypher file over the web browser, which then offers two options, either to add it to the favorites or to paste it in the editor.
I have a database dump at D:/backup.dump. I try to restore my database min_ro: I open psql.exe plugin. There are words
min_ro=#
Then I write restore command:
min_ro=# psql min_ro < D:/backup.dump
Then happens nothing. My database is not restored. What is wrong? It's first time using psql.
Update. I don't need psql only - I need to restore db from dump and cannot do it.
psql is not a SQL statement, so it doesn't make sense to enter that at the psql prompt which is there to run SQL statements (or psql meta commands).
c:\> psql min_ro < D:/backup.dump
needs to be entered on the (Windows) command line, not inside psql.
You can however just run the SQL script (which I assume your dump is) by using the \i ("include") meta command in `psql``
c:\> psql min_ro
min_ro=# \i D:/backup.dump
When you restore your database at pgAdminIII (by right-click at database name then choice 'restore') you can't see .dump files at backup list by default. That was my mistake forced me to try another ways to restore DB from dump.
But if you simply change file types to 'All files' you can restore your database from dump as usially.
I'm having an issue migrating my application's database after it has been pushed to Heroku. The part of the code that triggers the error is the following:
execute "COPY countries FROM '#{Rails.root}/db/migrate/Countries.txt' DELIMITER ',' CSV HEADER;"
execute "COPY regions FROM '#{Rails.root}/db/migrate/Regions.txt' DELIMITER ',' CSV HEADER;"
execute "COPY cities FROM '#{Rails.root}/db/migrate/Cities.txt' DELIMITER ',' CSV HEADER;"
Here is the error I'm getting:
PG::InsufficientPrivilege: ERROR: must be superuser to COPY to or from a file
HINT: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone.
: COPY countries FROM '/app/db/migrate/Countries.txt' DELIMITER ',' CSV HEADER;
rake aborted!
An error has occurred, this and all later migrations canceled:
So far, I have attempted to use "\copy" and "COPY FROM STDIN" as some of the old questions advised but keep getting syntax errors. If anyone could point me in the right direction, that would be great.
EDIT: Here are the questions I'm referencing. One:
I tried this:
execute "COPY countries FROM STDIN '#{Rails.root}/db/migrate/Countries.txt' DELIMITER ',' CSV HEADER;"
and this:
execute "COPY countries FROM '#{Rails.root}/db/migrate/Countries.txt' STDIN DELIMITER ',' CSV HEADER;"
Two:
I tried this:
execute \copy countries FROM STDIN '#{Rails.root}/db/migrate/Countries.txt' DELIMITER ',' CSV HEADER
Edit two:
Here was another attempt:
execute "COPY countries '#{Rails.root}/db/migrate/Countries.txt' FROM STDIN DELIMITER ',' CSV HEADER;"
execute "COPY regions '#{Rails.root}/db/migrate/Regions.txt' FROM STDIN DELIMITER ',' CSV HEADER;"
execute "COPY cities '#{Rails.root}/db/migrate/Cities.txt' FROM STDIN DELIMITER ',' CSV HEADER;"
The error I got from this was:
PG::SyntaxError: ERROR: syntax error at or near "'/app/db/migrate/Countries.txt'"
LINE 1: COPY countries '/app/db/migrate/Countries.txt' FROM STDIN DE...
^
: COPY countries '/app/db/migrate/Countries.txt' FROM STDIN DELIMITER ',' CSV HEADER;
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::SyntaxError: ERROR: syntax error at or near "'/app/db/migrate/Countries.txt'"
LINE 1: COPY countries '/app/db/migrate/Countries.txt' FROM STDIN DE...
Edit 3:
I wasn't able to resolve the issue I was having but found a simpler solution--creating a local dump and uploading that to heroku using their importing tools. Which can be found here.
Realizing that the question is fairly old, I'll provide another answer for the benefit of future generations since it is the first query that shows up on Google. One easy solution I found is:
grant the user SUPERUSER powers temporarily.
(Note that SUPERUSER is PostgreSQL flag and does not mean that you need to become system root user). You need to run the following in psql under postgres user:
alter user <username> superuser
If you do so you would not need to fight with \copy or STDIN imports anymore. This is a very quick and efficient shortcut (albeit a bit dangerous).
You can revoke the superuser privilege after you are done importing by doing:
alter user <username> nosuperuser
This solution is inspired by this answer.
Going through stdin worked for me...
(admittedly, from command line. Odd escaping of Contents is Windows-ish)
cat import.csv | psql -c "COPY cms.\"Contents\" FROM stdin DELIMITER ',' ...
according Heroku the users they create for postgres databases are created without superuser privileges. which means you don't have copy privileges.
It looks like the recommended way to import data into a heroku database is to create a db dump and import that instead of using COPY and csv files. Take a look at: https://devcenter.heroku.com/articles/heroku-postgres-import-export
Exactly as the error says: you are not a super user and you can't copy from a file.
Your syntax errors are the result of you using, again as the error says, invalid syntax. You can't copy from a file on Heroku, so you're going to have to make do with some other solution.
The answer here is what I would recommend doing.
Having just wrestled with this for a django app, I thought I'd share my solution.
Create Staging Schema in your db
Create table for source data in staging
Import data
Run INSERT script to write from staging table to target table
NB: I have the staging schema to run loads and transforms.
Via documentation:
COPY naming a file is only allowed to database superusers, since it allows reading or writing any file that the server has privileges to access.
https://www.postgresql.org/docs/9.2/static/sql-copy.html
You can overcome with next steps:
start psql
sudo -u postgres psql
Make user as superuser
alter user [user] superuser;
Check if user is superuser
select usesuper from pg_user where usename = '[user]';
P.S. Don't forget about ;