class MetricBase(SQLModel):
id: Optional[int] = Field(default=None, primary_key=True)
fact_name: str
dimensions: Optional[List] = Field(default=[])
measures: Optional[List] = Field(default=[])
params: Optional[Dict]
It would be nice to show a few examples about how to model arrays and json SQL columns.
In general what principles should I follow to convert from a SQLAlchemy Table definition?
from sqlalchemy import Column, Integer, String, DateTime, BigInteger, SmallInteger,LargeBinary, ForeignKey, Table, Float,Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects.postgresql import JSONB,JSON, ARRAY
class Metrics(Base):
__tablename__ = 'metrics'
__table_args__ = {'extend_existing':True}
# billing item id
id = Column(BigInteger, autoincrement=True, primary_key=True)
# the fact name
fact_name = Column(String,nullable=False)
dimensions = Column(ARRAY(String))
measures = Column(ARRAY(String))
sql_query = Column(String)
rest_query = Column(String)
params_query = Column(JSON)
chart_types = Column(JSON)
chart_title = Column(String)
First Check
Commit to Help
Example Code
Description
It would be nice to show a few examples about how to model arrays and json SQL columns.
In general what principles should I follow to convert from a SQLAlchemy Table definition?
Operating System
Linux
Operating System Details
Ubuntu 21.0
SQLModel Version
0.0.8
Python Version
3.8.10
Additional Context
For example I am trying to convert this existing table: