Django Docker Postgresql database import export - sql

I have a problem with postgresql database. I just want to able to export and import database like .sql file. But when using command line I am able to get .sql database file but when I'm trying to import it to database it's giving syntax errors in sql file. I can try to fix syntax errors in sql file but I don't want to solve this problem it like that.
I need to get exported sql file without any errors and to be able to import it without any issue. What can be a problem?
Postgresql version:postgres:14.6

Related

Restoring DB into pgAdmin4 does not accept my backup file format (.sql)

I have exported a copy of my local Postgres DB from PhpPgMyAdmin and the resulted file is a pretty normal .sql which contains both the structure and the data of the DB.
Then I have tried to import this structure and data to a remote DB connected via PgAdmin4 but I am getting this message at the moment:
pg_restore: error: input file appears to be a text format dump. Please
use psql.
I have tried to look for some file converter online to change the file format from .sql to .psql but I couldn't find any and anyway pgAdmin4 should accept .sql files which confuses me:
Any ideas?
Issue solved.
Under "Tool" select "Query Tool" and import your .sql file there.
For the query to be run I had to change the "OWNER" of the DB to the new "user" of the DB where I wanted to import the data.

Database duplicacy

I have a database in phpmyadmin. I am trying to export my tables in sql format. the export file is generated with nothing in it but when I try to export and save file in csv or json format data gets saved. When I import the csv or json file the import fails without giving any error. Can't understand why.
I want to duplicate my complete database from one system to another. How can I do so?

WAMP, PHPMyadmin, Import, CSV Error SQL query... #2006 - MySQL server has gone away

Im getting this error:
Error SQL query… #2006 - MySQL server has gone away
I'm suspecting the CSV file might be the source of the problem as other CSV work, I've tried changing the following values on the SQL server
the key_buffer_size = 900M
max_allowed_packet = 900M
But it doesnt seem to fix the problem, I've tried converting the file to SQL, XML but it just doesn't want to import.
any advice?
Here are the files:
CSV im traying to upload
CSV that works
With phpMyAdmin 4.4.13.1 and the CSV import, I was able to import your file, after I changed the first line to:
Username,Client Name,Date,Time,Published App,x
The only way I managed to import the file was to make smaller file and upload the one by one... which is strange as the csv wasn't that big 4MB thousand records...

How do I transfer an Postgres SQL Function from a 9.3 DB to another computer with same version?

I have a working function that was created and want to just transfer it to another newly installed Postgres DB.
I have checked around and seeing command line options which seems kinda of dry for a common task?
Is there a module import / export option?
I have exported the function into a .sql file from the database, so just looking for an import option.
I know very little about Postgres :)
How did you export it? If it exported as sql into a file named file_name.sql, you would just do:
psql -f file_name.sql
With whatever additional parameters are needed to connect to the correct server and database.

Can You Import an Excel File to a MySQL Database using phpMyAdmin?

Can You Import an Excel File to a MySQL Database using phpMyAdmin? I am looking to buy this database that has the data of all Colleges and Universities in the US. The file is in Excel format. Can this be imported into phpMyAdmin?
Here is the site where I am going to buy the database from if this is possible: http://www.data-lists.com/universities-colleges-database.html?gclid=CPGXkN6H6aECFeQc5wodBFPRIg
You can download a sample of the database that has 10 entries. I have tried importing this into phpMyAdmin but this is the error I am getting:
There is a chance that you may have
found a bug in the SQL parser. Please
examine your query closely, and check
that the quotes are correct and not
mis-matched. Other possible failure
causes may be that you are uploading a
file with binary outside of a quoted
text area. You can also try your query
on the MySQL command line interface.
The MySQL server error output below,
if there is any, may also help you in
diagnosing the problem. If you still
have problems or if the parser fails
where the command line interface
succeeds, please reduce your SQL query
input to the single query that causes
problems, and submit a bug report with
the data chunk in the CUT section
below:
----BEGIN CUT---- eNrtXAtsHMd5nt177R0FipQoiXqvICkiJd7xnnwJBnWiqFdIiubRjyQO5NVxSV51vGPuIYltVNNt
CgS1azhSIre20sBNXLRp2jSOm9iIW8stYLcA3RZtmodjN3Zgp3FdtLWbokVg+/rPzO7evnkXyYna
zhyHd/PvzP/N/PPP7Mw+vtGpqVNTQ+JITByJi2OjE0NiTIyLqYFkNBnKTMOR9lAoczuI95yYGRLL
H8svSqWyXIrkc2cii/OLYiyWiiXEeDQ6EIa/+IAY6xuK9Q+lEh8W8/LCoLgnNL6UuXVsSExFopH+
And then at the bottom of the error it says:
1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server
version for the right syntax to use
near 'ÐÏࡱá' at line 1
Any help is greatly appreciated.
It looks like you are trying to import a binary file.
Try to export a sheet or a range of the excel file as a CSV file. This must be a reactangle with the same structure on every row.
I've downloaded the sample data and it looks pretty organized. Just save the excel file into csv (File -> save as). Then import it using PHPMyAdmin. I think it will work perfectly fine.
Good luck! :-)