Hello. I’m trying to figure out what is the logic ...
# gooddata-platform
j
Hello. I’m trying to figure out what is the logic and why most of the numeric (int, bigint) columns in my physical data model are generated as attributes in the logical data model instead of integers/facts. I’m scanning the physical data model from our database schema and then generating the logical data model using the Python SDK. Anyone knows what makes column to become a fact in this process?
j
Hi Jani, first, please, post messages related to GoodData cloud/CN to corresponding channels, this channel is dedicated to the former GoodData platform (data are stored on our side). That is why I overlooked your question, btw. 😉 Second, the default is to generate FACTs only from NUMERIC columns, all STRING/INT-like data types are generated as attributes. This behavior cannot be overridden in any way, not yet. Out of my curiosity - do you use dbt for transformations?
j
Ah sorry about posting this to the wrong channel. Got confused on the purpose between this and the CN one. I don’t use dbt. I guess then my question is how the physical model scanning decides which columns in the database becomes NUMERIC? I assumed that integers are also numeric. Perhaps the source SQL DB schema must actually define the type as decimal/numeric even for ints.
j
Our logic is based on JDBC data types. This is how we map JDBC data types to our data types, visible in LDM Modeler or when you get PDM from API (/api/v1/layout/dataSources/<id>/physicalModel):
Copy code
class DataTypes {
    companion object {
        val SUPPORTED = hashMapOf(
            "BIT" to <http://DataColumnType.INT|DataColumnType.INT>,
            "TINYINT" to <http://DataColumnType.INT|DataColumnType.INT>,
            "SMALLINT" to <http://DataColumnType.INT|DataColumnType.INT>,
            "INTEGER" to <http://DataColumnType.INT|DataColumnType.INT>,
            "BIGINT" to <http://DataColumnType.INT|DataColumnType.INT>,
            "CHAR" to DataColumnType.STRING,
            "VARCHAR" to DataColumnType.STRING,
            "LONGVARCHAR" to DataColumnType.STRING,
            "CLOB" to DataColumnType.STRING,
            "NCHAR" to DataColumnType.STRING,
            "NVARCHAR" to DataColumnType.STRING,
            "LONGNVARCHAR" to DataColumnType.STRING,
            "NCLOB" to DataColumnType.STRING,
            "SQLXML" to DataColumnType.STRING,
            "ROWID" to DataColumnType.STRING,
            "FLOAT" to DataColumnType.NUMERIC,
            "REAL" to DataColumnType.NUMERIC,
            "DOUBLE" to DataColumnType.NUMERIC,
            "NUMERIC" to DataColumnType.NUMERIC,
            "DECIMAL" to DataColumnType.NUMERIC,
            "DATE" to DataColumnType.DATE,
            "TIMESTAMP" to DataColumnType.TIMESTAMP,
            "TIMESTAMP_WITH_TIMEZONE" to DataColumnType.TIMESTAMP_TZ,
            "BOOLEAN" to DataColumnType.BOOLEAN
        )
    }
}
👍 1
Only
our
NUMERIC is translated to FACT.
Generally, only data types with decimal point, so not integers
p
🎉 New note created.