-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for SQLite to PostgreSQL data type conversion (#797)
* Add unit tests for SQLite to PostgreSQL data type conversion logic * Fix blob and decimal support for sqlite uploads
- Loading branch information
Showing
2 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from splitgraph.ingestion.sqlite import sqlite_to_postgres_type | ||
|
||
|
||
def test_type_mapping(): | ||
assert sqlite_to_postgres_type("INT") == "INTEGER" | ||
assert sqlite_to_postgres_type("TEXT") == "TEXT" | ||
assert sqlite_to_postgres_type("text") == "TEXT" | ||
assert sqlite_to_postgres_type("varchar(255)") == "VARCHAR(255)" | ||
assert sqlite_to_postgres_type("VARCHAR(255)") == "VARCHAR(255)" | ||
assert sqlite_to_postgres_type("REAL") == "REAL" | ||
assert sqlite_to_postgres_type("real") == "REAL" | ||
assert sqlite_to_postgres_type("decimal(2,10)") == "DECIMAL(2,10)" | ||
assert sqlite_to_postgres_type("decimal(20,100)") == "DECIMAL(20,100)" | ||
assert sqlite_to_postgres_type("BLOB") == "BYTEA" | ||
assert sqlite_to_postgres_type("decimal(2, 20)") == "DECIMAL(2,20)" | ||
assert sqlite_to_postgres_type("NATIVE CHARACTER(70)") == "VARCHAR(70)" | ||
assert sqlite_to_postgres_type("NVARCHAR(160)") == "VARCHAR(160)" |