Data Types¶
Felis has an internal type system that is used to define the data types of columns in a schema. These are mapped to the appropriate SQL data types when the schema is created in a database and the corresponding VOTable data type when writing information to TAP_SCHEMA.
The following values are supported for the datatype field of a column object:
Type |
Description |
Notes |
---|---|---|
boolean |
boolean value |
|
byte |
8-bit signed integer |
See footnote [1] |
short |
16-bit signed integer |
|
int |
32-bit signed integer |
|
long |
64-bit signed integer |
|
float |
32-bit floating point number |
IEEE 745 single precision floating point number |
double |
64-bit floating point number |
IEEE 745 double precision floating point number |
char |
fixed-length character string |
|
string |
variable-length character string |
|
unicode |
variable-length Unicode string |
Usage of this type is discouraged as it maps to the obsolete UCS-2 encoding in VOTable, and is not usable for UTF-8 strings. |
text |
variable-length text string |
|
binary |
variable-length binary blob |
|
timestamp |
timestamp value |
Data Type Mappings¶
Felis types are mapped to SQL types when creating a schema in a database and VOTable primitives when writing information to TAP_SCHEMA. The following table shows these mapping:
Felis |
SQLite [2] |
MySQL |
PostgreSQL |
VOTable |
---|---|---|---|---|
boolean |
BOOLEAN |
BOOLEAN |
BOOLEAN |
boolean |
byte [1] |
TINYINT |
TINYINT |
SMALLINT |
unsignedByte |
short |
SMALLINT |
SMALLINT |
SMALLINT |
short |
int |
INTEGER |
INTEGER |
INTEGER |
int |
long |
BIGINT |
BIGINT |
BIGINT |
long |
float |
FLOAT |
FLOAT |
FLOAT |
float |
double |
DOUBLE |
DOUBLE |
DOUBLE PRECISION |
double |
char |
CHAR |
CHAR |
CHAR |
char |
string |
VARCHAR |
VARCHAR |
VARCHAR |
char |
unicode |
NVARCHAR |
NVARCHAR |
VARCHAR |
unicodeChar |
text |
TEXT |
LONGTEXT |
TEXT |
uncodeChar |
binary |
BLOB |
LONGBLOB |
BYTEA |
unsignedByte |
timestamp |
TIMESTAMP |
DATETIME |
TIMESTAMP |
char |
SQLite data types use storage classes. The types listed here represent the emitted SQL type for the given Felis type in SQLAlchemy rather than the storage class and are also indicative of the generic SQL type that is emitted when no database dialect is specified.