Skip to content

Commit

Permalink
Merge pull request #20 from firebend/19-real-fields-are-treated-as-in…
Browse files Browse the repository at this point in the history
…tegers

Merge upstream changes from wintersd
  • Loading branch information
zyzil authored Jun 27, 2022
2 parents 5f1421d + 07219a2 commit 0d52867
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Create a config file containing the database connection credentials, e.g.:
```json
{
"host": "localhost",
"database": "db",
"port": "3306",
"user": "root",
"password": "password",
Expand Down
9 changes: 5 additions & 4 deletions tap_mssql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@
"smallint": 2,
"mediumint": 3,
"int": 4,
"real": 4,
"bigint": 8,
"timestamp": 8,
}

FLOAT_TYPES = set(["float", "double", "money"])
FLOAT_TYPES = set(["float", "double", "real"])

DECIMAL_TYPES = set(["decimal", "number", "money"])

DATETIME_TYPES = set(
["datetime", "datetime2", "date", "smalldatetime", "datetimeoffset"]
Expand Down Expand Up @@ -110,9 +111,9 @@ def schema_for_column(c):

elif data_type in FLOAT_TYPES:
result.type = ["null", "number"]
result.multipleOf = 10 ** (0 - (c.numeric_scale or 6))
result.multipleOf = 10 ** (0 - (c.numeric_scale or 17))

elif data_type in ["decimal", "numeric"]:
elif data_type in DECIMAL_TYPES:
result.type = ["null", "number"]
result.multipleOf = 10 ** (0 - c.numeric_scale)
return result
Expand Down

0 comments on commit 0d52867

Please sign in to comment.