Hello,
We wish to import data in a table from a csv. The copy command fails as super user permissions are not there. I have raised a ticket. But the issue is not resolved yet.
Are there any easy tools or any other options by which this can be executed? Copy data in a csv nia table.
regards
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
Indeed, uploading a file directly to a managed database is quite likely not going to work with the default permissions.
What I could suggest is to use a script to do the import. For example, you could use the following Python script to do the import:
import pandas as pd
df = pd.read_csv('/path/to/your.csv')
df.columns = [c.lower() for c in df.columns] # PostgreSQL doesn't like capitals or spaces
from sqlalchemy import create_engine
engine = create_engine('postgresql://username:password@localhost:5432/dbname')
df.to_sql("my_table_name", engine)
Make sure to change the connection string and the table name.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.