Is this good idea to split table with many field for on two parts for convenience?
Real example:
class UserData(Base):
__tablename__ = "users_data"
id = Column(Integer, primary_key=True, index=True)
age = Column(Integer, index=True)
first_name = Column(String, index=True)
last_name = Column(String, index=True)
country = Column(String, index=True)
city = Column(String, index=True)
comment = Column(String, index=True)
users_meta = relationship("UserMeta", uselist=False, back_populates="users_data")
class UserMeta(Base):
__tablename__ = "users_meta"
id = Column(Integer, primary_key=True)
email = Column(String, unique=True, index=True)
hashed_password = Column(String)
created = Column(DateTime(timezone=True), server_default=func.now())
last_visited = Column(DateTime(timezone=True))
is_active = Column(Boolean, default=True)
user_data_id = Column(Integer, ForeignKey('users_data.id'))
users_data = relationship("UserData", back_populates="users_meta")
So in one table only id and data about user, the second table is a meta info. Currently I'm don't know how many times and which fields I will use more than other.
A one more bonus question it is, is I need to create third table with correlation between email and id or I can do it without it?
P.S. I hope the data is pretty understandable to no translate in standard SQL format