Comments (6)
Hi,
Though I took a fast look, the "stride" seems to be supported for only binary not csv.
http://ossc-db.github.io/pg_bulkload/pg_bulkload.html
Binary input format
STRIDE = n
Length of one row. Use if you want to truncate the end of row. The default is whole of the row, which means the total of COLs.
from pg_bulkload.
@mikecaat - looks like your spot on, thanks.
I am trying to move from mariadb to postgres and their "copy" command is not very flexible compared to "mysqlimport".
We digest huge csv files daily and the way the csv files are they have an additional separator at the end if its an empty field or not.
a^b^c^d^^
a^b^c^d^e^
The files are just to large to run "sed" over them and haven't found a clean way of handling this :/
from pg_bulkload.
Hmm, is the following your expected result?
$ cat /tmp/test.csv
a^b^c^d^^
a^b^c^d^e^
psql=# CREATE TABLE test (a text, b text, c text, d text, e text, f text);
CREATE TABLE
psql=# COPY test FROM '/tmp/test.csv' WITH (FORMAT CSV, DELIMITER '^');
COPY 2
psql=# SELECT * FROM test;
a | b | c | d | e | f
---+---+---+---+--------+--------
a | b | c | d | (null) | (null)
a | b | c | d | e | (null)
(2 rows)
from pg_bulkload.
Whoops sorry my mistake...
I comes likes this. It always adds one extra regardless :/
a^b^c^d^^^
a^b^c^d^e^^
The other hassle is that when they decide to add new fields to the end of the csv file we have to race and update the table with the new fields.
With mysqlimport any additional field is completely ignored and still loads the table, this gives us time to add extra fields at our leisure.
from pg_bulkload.
Oh, that’s hassle.
Though there are some workaround including using the pg_bulkload’s Fillter function, I agree that mysqlimport’s way is better for your case.
https://stackoverflow.com/questions/12618232/copy-a-few-of-the-columns-of-a-csv-file-into-a-table
from pg_bulkload.
Thanks mate for the info... I will see what I can come up with that's some what reliable, otherwise we will be sticking with mariadb :)
from pg_bulkload.
Related Issues (20)
- installcheck not passed with pg12 pg13 pg14 HOT 10
- Cannot load unquoted CSV data?
- Build Errors Postgresql 14 - master branch HOT 2
- Compile Error in Ubuntu LTS 22.04 HOT 2
- new lines in fields HOT 2
- delimiter - extended string syntax
- failed to install HOT 7
- unable to load to citus distributed table
- PostgreSQL 15 support HOT 4
- Cannot Make HOT 4
- update deprecated actoins for github actions
- Make impossible on Ubuntu HOT 6
- Error on Ubuntu
- Extension version pg_bulkload mistake HOT 6
- rpmbuild issue and question
- what is recovery command's major purpose ?
- pg_bulkload on PG13 fails to handle large data duplicates HOT 8
- missing img in the doc
- PostgreSQL 16 support HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pg_bulkload.