1-csv Importing PostgreSQL
• Description of the problem:You need to import the CSV to the local database, but columns a lot, do not want to create a new table, and set each field name, type, and copy from
• Solutions:The Python pandas package makes it easy to import names and data from CSV into a database
from Import Create_engine Import = create_engine ('postgresql://user:[email protected]/db_name'= Pd.read_csv ('/path/to/csv_file') df.to_sql ('pandas_db ', engine
You can also add the if_exists parameter, which is used to replace or add to the existing data table, e.g.
Df.to_sql ('pandas_db', engine, if_exists='replace')
This also applies to adding documents.
For related documents see: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_sql.html 2-postgresql Connection PostGIS for space operation
• Questions:Convert column to type, error
ERROR: "geometry" not exist
The reason is that the PostGIS module is missing
• Solutions:-Open Pgadmin-Select Working Database-click on SQL Add Command-execute "CREATE EXTENSION PostGIS;"
Continuous update ...
Postsql | Debug record