![]() You could connect to the database on on a client such as Sqlectron. Now if you see message like COPY 2 on terminal, you know the import was successful. Run psql docker exec -it mydb psql -U postgres -d your_database // import CSV \copy anime FROM '/var/lib/postgresql/data/AnimeList.csv' DELIMITER ',' CSV HEADER Since we created the schema on the database your_database, we will also import csv here -d: indicate what database we are importing the csv into.Then we can start psql client on the Docker database : mv /AnimeList.csv pgdata/ Import CSV into database We need to place the csv file inside the /pgdata folder so that the your_database can read it from the /var/lib/postgresql/data folder inside Docker. There are lots of auto generated postgresql data created inside the /pgdata folder. Inside the local folder $HOME/Sync/animeDB, you can see a /pgdata folder gets created. -rm: remove the database when the instance is stoppedĭocker run -rm -name mydb -v $HOME/Sync/animeDB/pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=1234 -e POSTGRES_DB=your_database -p 6666:5432 myrepo/mypostgres:2.-p: map the port number and expose the port as 6666.v: map the persistent volume paths between the host and docker.mypostgres: the name you give to the database image.Dockerfile FROM postgres:alpine COPY *.sql /docker-entrypoint-initdb.d/ ADD setup.sql /docker-entrypoint-initdb.d RUN chmod a r /docker-entrypoint-initdb.d/* EXPOSE 6666Īfter we create the Dockerfile and setup.sql, we could build the docker image: Then, in the Dockerfile, place the setup.sql inside /docker-entrypoint-initdb.d folder to create the schema in the initialization phase. setup.sql // there are more columns in AnimeList.csv but i am using a simplified dataset for now // Data may need to be cleaned further before import CREATE TABLE anime ( anime_id INT PRIMARY KEY, title TEXT ) Build your next app with the simplicity and flexibility of a multi-model database that scales to meet demand. sql script to create schema and run the script during database creation. Build apps faster on a fully managed SQL database Part of the Azure SQL family, Azure SQL Database is an always-up-to-date, fully managed relational database service built for the cloud. sqlectron / sqlectron-gui Notifications Fork Star 4. To create the schema during database creation, we could write a. Create a Docker databaseīefore importing csv files into the database, we need to create the corresponding schema for each column in the csv. To keep myself interested and engaged, I chose myanimelist datasets so that I could also learn about popular animes. ![]() There are tens and thousands of datasets available on Kaggle from image to neurolinguistics. ![]() The process seems pretty straightforward, with a small tricky part - the mounted csv needs to be placed in the mounted volume and accessed via the database inside Docker. This post is an account of how I populate a database with datasets in csv downloaded from Kaggle. ![]() The cli was also one attempt to give a look in some interesting libs that were coming a long for node-js to run in cli and react, but it come to a point that libs were not that stable and because that sqlectron-terminal it's not getting to much improvements lately, i think it would be nice to move that for a go or something else, but we have been paying more attention to improve the desktop version now.For my purpose, I want to create a database populated with data so that I could have my caching experiment - Making a small app to make request to the database and comparing the difference in the request numbers when caching is applied.īut first, I need to have a database populated with data. and tests technologies like electron/react/redux outside the web world. In the meanwhile thanks for the feedback, and the feature bullet list, the project still in the early days it was created mainly for our usage in projects that we were working, to have some decent desktop client to PostgreSQL and be cross-platform. but often is what we need for perform tasks in daily bases. ![]() for sure a simple desktop query client it's not for all job task. I didn't know DBeaver as i do not use eclipse, it's look nice, but i thinks is agnostic for what we are looking for to purpose, we want to keep it simple as a query client for database, what "MySQL Query Browser was to mysql". Hey thanks for the feedback, the idea behind the project is to create a cross-platform gui client. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |