the .fullname attribute is not used directly in SQL statements, when a schema or table name requires quoting the compiler will apply them as needed.
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy.dialects import mysql
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session
Base = declarative_base()
class SomeTable(Base):
__tablename__ = "3table"
id = Column(String, primary_key=True)
__table_args__ = {"schema": "4schema"}
s = Session()
print(s.query(SomeTable).statement.compile(dialect=mysql.dialect()))
output:
SELECT `4schema`.`3table`.id
FROM `4schema`.`3table`