Questions tagged [csv]

Questions on how to import into, extract data from, or exchange data between databases in CSV format (plain text using commas to separate values).

272 questions
20
votes
2 answers

Export remote Postgres table to CSV file on local machine

I have read-only access to a database on a remote server. So, I can execute: COPY products TO '/tmp/products.csv' DELIMITER ','; But on that server I don't have permissions to create/save a file, so I need to do this on my local machine. When I…
tasmaniski
  • 1,005
  • 4
  • 11
  • 16
18
votes
5 answers

MySQL import csv file ERROR 13 (HY000): Can't get stat of /path/file.csv (Errcode: 2)

I am an absolute beginner to MySQL (5.5.34) / Linux (Ubuntu 12.04 LTS)` I have created a simple database with one table. When trying to import data into it via a 'data_test.csv file an error message 13 appears. Exert from Terminal follows: mysql>…
Guillermo
  • 183
  • 1
  • 1
  • 5
16
votes
2 answers

How can I dump all tables to CSV for a PostgreSQL schema?

I have a database with a lot of schemas in it and I want to dump the each of the table contents to CSV. I'm aware of the COPY command but I'm not sure how to script something that will read all of the tables in a schema and execute the COPY against…
robertpostill
  • 317
  • 1
  • 2
  • 7
15
votes
3 answers

Create a table from a CSV file with headers

I'm seeking to find a way to generate a new MySQL table solely based on the contents of a specified CSV. The CSV files I'll be using have the following properties; "|" delimited. First row specifies the column names (headers), also "|" delimited.…
user58602
  • 151
  • 1
  • 1
  • 3
14
votes
5 answers

Save Results as CSV *with* headers in SSMS

With SQL Server 2008 R2, when I save the results as a CSV there are no headers. I can work around this by copying and pasting with the "Copy with Headers" , or just grab the headers and paste them in the CSV etc, but is there a better way to do…
Kyle Brandt
  • 2,335
  • 8
  • 29
  • 37
14
votes
2 answers

Can I query a tab-delimited file from SSMS?

Is it possible to query a tab-delimited file from Sql Server Management Studio to view its data without saving it anywhere? I know you can BULK INSERT from a tab-delimited file using something like: BULK INSERT SomeTable FROM 'MyFile.txt' WITH…
Rachel
  • 8,229
  • 20
  • 46
  • 74
10
votes
4 answers

Import in postgres json data in a csv file

I'm trying to import into postgres a csv file containing the data for a table. One of the column of the table has jsonb type. One line of my csv file contains something like 1,{"a":"b"} Suppose the table has a schema id | smallint …
marcosh
  • 231
  • 1
  • 2
  • 6
8
votes
2 answers

Inserting all csv files into a table in MySQL

I am looking for a way to insert all my csv files into MySQL without having to write several LOAD DATA INFILE statements. I have many csv files I need to insert and the files themselves are very large. I have tried *.csv, but this does not work.
dunce1
  • 201
  • 1
  • 2
  • 4
8
votes
2 answers

MySQL - CSV UPDATE (not INSERT) into existing table?

I have a table with the following columns: id | name | city The table has 1000 entries in it. I have a CSV file with a limited number of lines like this: id,city 34,Denver 45,Kansas City 145,New York Can I use LOAD DATA INFILE to import my CSV…
Jake Wilson
  • 2,277
  • 8
  • 20
  • 23
7
votes
3 answers

SQLite CSV import won't create a table automatically

According to https://www.sqlite.org/cli.html#csv, sqlite> .mode csv sqlite> .import C:/work/somedata.csv tab1 There are two cases to consider: (1) Table "tab1" does not previously exist and (2) table "tab1" does already exist. In the first case,…
200_success
  • 194
  • 1
  • 10
7
votes
4 answers

Import CSV or JSON file into DynamoDB

I have 1000 CSV files. Each CSV file is between 1 and 500 MB and is formatted the same way (i.e. same column order). I have a header file for column headers, which match my DynamoDB table's column names. I need to import those files into a DynamoDB…
Franck Dernoncourt
  • 1,875
  • 10
  • 31
  • 48
7
votes
4 answers

psql denies access to file when using COPY FROM

When I do this: COPY "mytable" FROM '/my/file.csv' WITH DELIMITER AS ',' CSV; On this: -rw-r--r-- 1 peter peter 54819176 2011-07-21 13:17 file.csv psql tells me this: ERROR: could not open file "/my/file.csv" for reading: Permission denied How…
Pete
  • 173
  • 1
  • 1
  • 6
7
votes
1 answer

How many disk seeks does it take to write one row on SQLite?

As far as I understand, there can be one disk-seek per rotation of a harddisk, therefore I am interested to know how many disk seeks are needed for writing a row to an SQLite table, including locking etc. Assume that there are no indexes on the…
David
  • 1,145
  • 1
  • 11
  • 27
6
votes
1 answer

Using mysql's load infile to only populate certain columns

I have a csv file with a lot of data in it and I want to upload it into a mysql table. However, I would like to keep one column (primary id) empty so I can edit it myself. In mysql's documentation it says that you can specify columns, but from my…
JONPON
  • 163
  • 1
  • 1
  • 4
6
votes
1 answer

MySQL Import CSV with Multiple Field Separators

I'm trying to import this CSV file into MySQL that appears to be optionally enclosed by more than one character. Unfortunately, MySQL only supports one character as a field separator. I am stuck doing this entire process in SQL as it is part of a…
Kevin
  • 163
  • 1
  • 6
1
2 3
18 19