Skip to content

Commit

Permalink
fix bigints postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Apr 14, 2023
1 parent 05c2f78 commit 332ab62
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 164 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "csvs_convert"
version = "0.8.2"
version = "0.8.3"
edition = "2021"

description = "Some Datapackage Conversion"
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.8.3] - 2023-04-14

### Changed

- Fix postgres to use bigints as they are what is detected.

## [0.8.2] - 2023-04-12

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/converters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ fn to_db_type(type_: String, format: String) -> String {
"number" => "NUMERIC".to_string(),
"object" => "JSONB".to_string(),
"array" => "JSONB".to_string(),
"integer" => "INTEGER".to_string(),
"integer" => "BIGINT".to_string(),
"boolean" => "BOOL".to_string(),
_ => "TEXT".to_string(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/fixtures/all_types.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
string,array,object,date,datetime,time,boolean,number,integer
122,"[4,5]","{""a"":""b""}","2005-01-12","2005-01-12 20:20","12:12",true,23.3,23
foo,"[4,9]","{""c"":""b""}",2005-01-12,2005-01-12 20:20,12:12,true,23.3,23
122,"[4,5]","{""a"":""b""}","2005-01-12","2005-01-12 20:20","12:12",true,23.3,1010041430000
foo,"[4,9]","{""c"":""b""}",2005-01-12,2005-01-12 20:20,12:12,true,23.3,1010041430000
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: lines
- " , \"time\" TEXT "
- " , \"boolean\" BOOL "
- " , \"number\" NUMERIC "
- " , \"integer\" INTEGER "
- " , \"integer\" BIGINT "
- "); "
- ""
- "\\copy \"all_types_semi_colon\"(\"string\", \"array\", \"object\", \"date\", \"datetime\", \"time\", \"boolean\", \"number\", \"integer\") from '/projects/datapackage_convert/src/fixtures/all_types_semi_colon.csv' WITH CSV HEADER QUOTE '\"' DELIMITER ';'"
Expand All @@ -22,7 +22,7 @@ expression: lines
- " , \"time\" TEXT "
- " , \"boolean\" BOOL "
- " , \"number\" NUMERIC "
- " , \"integer\" INTEGER "
- " , \"integer\" BIGINT "
- "); "
- ""
- "\\copy \"all_types\"(\"string\", \"array\", \"object\", \"date\", \"datetime\", \"time\", \"boolean\", \"number\", \"integer\") from '/projects/datapackage_convert/src/fixtures/all_types.csv' WITH CSV HEADER QUOTE '\"' DELIMITER ','"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ expression: lines
- " , [time] TEXT "
- " , [boolean] BOOL "
- " , [number] NUMERIC "
- " , [integer] INTEGER "
- " , [integer] BIGINT "
- "); "
- ""
- ".separator ';'"
Expand All @@ -30,7 +30,7 @@ expression: lines
- " , [time] TEXT "
- " , [boolean] BOOL "
- " , [number] NUMERIC "
- " , [integer] INTEGER "
- " , [integer] BIGINT "
- "); "
- ""
- ".separator ','"
Expand Down
16 changes: 8 additions & 8 deletions src/snapshots/csvs_convert__describe__tests__basic_multi.snap
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@ resources:
type: integer
format: integer
stats:
min_len: 2
max_len: 2
min_str: "23"
max_str: "23"
min_number: 23
max_number: 23
min_len: 13
max_len: 13
min_str: "1010041430000"
max_str: "1010041430000"
min_number: 1010041430000
max_number: 1010041430000
count: 2
empty_count: 0
estimate_unique: 1
sum: 46
mean: 23
sum: 2020082860000
mean: 1010041430000
path: src/fixtures/all_types.csv
dialect:
delimiter: ","
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,22 @@ expression: rows
- integer
- integer
- integer
- "2"
- "2"
- "23"
- "23"
- "13"
- "13"
- "1010041430000"
- "1010041430000"
- "2"
- "0"
- "1"
- ""
- "46.0"
- "23.0"
- "2020082860000.0"
- "1010041430000.0"
- "0.0"
- "0.0"
- "23.0"
- "23.0"
- "23.0"
- "23.0"
- "23.0"
- "[23.0,23.0,23.0,23.0,23.0,23.0,23.0,23.0,23.0]"
- "1010041430000.0"
- "1010041430000.0"
- "1010041430000.0"
- "1010041430000.0"
- "1010041430000.0"
- "[1010041430000.0,1010041430000.0,1010041430000.0,1010041430000.0,1010041430000.0,1010041430000.0,1010041430000.0,1010041430000.0,1010041429999.9999]"

240 changes: 120 additions & 120 deletions src/snapshots/csvs_convert__describe__tests__write_datapackage.snap
Original file line number Diff line number Diff line change
Expand Up @@ -335,136 +335,136 @@ resources:
type: integer
format: integer
stats:
min_len: 2
max_len: 2
min_str: "23"
max_str: "23"
min_len: 13
max_len: 13
min_str: "1010041430000"
max_str: "1010041430000"
count: 2
empty_count: 0
exact_unique: 1
estimate_unique: ~
top_20:
- - "23"
- - "1010041430000"
- 2
sum: 46
mean: 23
sum: 2020082860000
mean: 1010041430000
variance: 0
stddev: 0
min_number: 23
max_number: 23
median: 23
lower_quartile: 23
upper_quartile: 23
min_number: 1010041430000
max_number: 1010041430000
median: 1010041430000
lower_quartile: 1010041430000
upper_quartile: 1010041430000
deciles:
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
centiles:
- 23
- 23
- 23
- 23
- 23.000000000000004
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23.000000000000004
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 22.999999999999996
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23
- 23.000000000000004
- 23
- 23
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
- 1010041430000
path: all_types.csv
dialect:
delimiter: ","
Expand Down
Loading

0 comments on commit 332ab62

Please sign in to comment.