# Path: spanner_orm/error.py
# class SpannerError(Exception):
# class ValidationError(Exception):
# 
# Path: spanner_orm/field.py
# class FieldType(abc.ABC):
# class Field(object):
# class Boolean(FieldType):
# class Integer(FieldType):
# class Float(FieldType):
# class String(FieldType):
# class StringArray(FieldType):
# class Timestamp(FieldType):
# class BytesBase64(FieldType):
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def __init__(self,
#                field_type: Type[FieldType],
#                nullable: bool = False,
#                primary_key: bool = False):
#   def ddl(self) -> str:
#   def field_type(self) -> Type[FieldType]:
#   def grpc_type(self) -> str:
#   def nullable(self) -> bool:
#   def primary_key(self) -> bool:
#   def validate(self, value) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value) -> None:
# ALL_TYPES = [
#     Boolean, Integer, Float, String, StringArray, Timestamp, BytesBase64
# ]
# 
# Path: spanner_orm/foreign_key_relationship.py
# class ForeignKeyRelationshipConstraint:
# class ForeignKeyRelationship(object):
#   def __init__(self, referenced_table_name: str, columns: Mapping[str, str]):
#   def constraint(self) -> ForeignKeyRelationshipConstraint:
#   def ddl(self) -> str:
#   def _parse_constraint(self) -> ForeignKeyRelationshipConstraint:
#   def single(self) -> bool:
# 
# Path: spanner_orm/index.py
# class Index(object):
#   PRIMARY_INDEX = 'PRIMARY_KEY'
#   def __init__(self,
#                columns: List[str],
#                parent: Optional[str] = None,
#                null_filtered: bool = False,
#                unique: bool = False,
#                storing_columns: Optional[List[str]] = None):
#   def primary(self) -> bool:
# 
# Path: spanner_orm/registry.py
# class RegistryComponent:
# class Registry(object):
#   def add(self, reference: Type[Any]) -> None:
#   def __init__(self):
#   def _name_from_class(self, klass: Type[Any]) -> str:
#   def register(self, to_register: Type[Any]) -> None:
#   def get(self, name: Union[Type[Any], str]) -> Type[Any]:
# def model_registry():
# 
# Path: spanner_orm/relationship.py
# class RelationshipConstraint:
# class Relationship(object):
#   def __init__(self,
#                destination_handle: Union[Type[Any], str],
#                constraints: Dict[str, str],
#                is_parent: bool = False,
#                single: bool = False):
#   def constraints(self) -> List[RelationshipConstraint]:
#   def destination(self) -> Type[Any]:
#   def single(self) -> bool:
#   def _parse_constraints(self) -> List[RelationshipConstraint]:


from typing import Any, Dict, Type, Optional
from spanner_orm import error
from spanner_orm import field
from spanner_orm import foreign_key_relationship
from spanner_orm import index
from spanner_orm import registry
from spanner_orm import relationship
      self.indexes[index.Index.PRIMARY_INDEX] = primary_index
    self.primary_keys = self.indexes[index.Index.PRIMARY_INDEX].columns

    self.columns = [f.name for f in sorted_fields]

    for _, relation in self.relations.items():
      relation.origin = self.model_class
    registry.model_registry().register(self.model_class)
    self._finalized = True

  def add_metadata(self, metadata: 'ModelMetadata') -> None:
    self.table = metadata.table or self.table
    self.fields.update(metadata.fields)
    self.relations.update(metadata.relations)
    self.indexes.update(metadata.indexes)
    self.interleaved = metadata.interleaved or self.interleaved

  def add_field(self, name: str, new_field: field.Field) -> None:
    new_field.name = name
    new_field.position = len(self.fields)
    self.fields[name] = new_field

  def add_relation(self, name: str,
                   new_relation: relationship.Relationship) -> None:
    new_relation.name = name
    self.relations[name] = new_relation

  def add_foreign_key_relation(
      self,
      name: str,

# Path: spanner_orm/error.py
# class SpannerError(Exception):
# class ValidationError(Exception):
# 
# Path: spanner_orm/field.py
# class FieldType(abc.ABC):
# class Field(object):
# class Boolean(FieldType):
# class Integer(FieldType):
# class Float(FieldType):
# class String(FieldType):
# class StringArray(FieldType):
# class Timestamp(FieldType):
# class BytesBase64(FieldType):
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def __init__(self,
#                field_type: Type[FieldType],
#                nullable: bool = False,
#                primary_key: bool = False):
#   def ddl(self) -> str:
#   def field_type(self) -> Type[FieldType]:
#   def grpc_type(self) -> str:
#   def nullable(self) -> bool:
#   def primary_key(self) -> bool:
#   def validate(self, value) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value: Any) -> None:
#   def ddl() -> str:
#   def grpc_type() -> type_pb2.Type:
#   def validate_type(value) -> None:
# ALL_TYPES = [
#     Boolean, Integer, Float, String, StringArray, Timestamp, BytesBase64
# ]
# 
# Path: spanner_orm/foreign_key_relationship.py
# class ForeignKeyRelationshipConstraint:
# class ForeignKeyRelationship(object):
#   def __init__(self, referenced_table_name: str, columns: Mapping[str, str]):
#   def constraint(self) -> ForeignKeyRelationshipConstraint:
#   def ddl(self) -> str:
#   def _parse_constraint(self) -> ForeignKeyRelationshipConstraint:
#   def single(self) -> bool:
# 
# Path: spanner_orm/index.py
# class Index(object):
#   PRIMARY_INDEX = 'PRIMARY_KEY'
#   def __init__(self,
#                columns: List[str],
#                parent: Optional[str] = None,
#                null_filtered: bool = False,
#                unique: bool = False,
#                storing_columns: Optional[List[str]] = None):
#   def primary(self) -> bool:
# 
# Path: spanner_orm/registry.py
# class RegistryComponent:
# class Registry(object):
#   def add(self, reference: Type[Any]) -> None:
#   def __init__(self):
#   def _name_from_class(self, klass: Type[Any]) -> str:
#   def register(self, to_register: Type[Any]) -> None:
#   def get(self, name: Union[Type[Any], str]) -> Type[Any]:
# def model_registry():
# 
# Path: spanner_orm/relationship.py
# class RelationshipConstraint:
# class Relationship(object):
#   def __init__(self,
#                destination_handle: Union[Type[Any], str],
#                constraints: Dict[str, str],
#                is_parent: bool = False,
#                single: bool = False):
#   def constraints(self) -> List[RelationshipConstraint]:
#   def destination(self) -> Type[Any]:
#   def single(self) -> bool:
#   def _parse_constraints(self) -> List[RelationshipConstraint]:


# Path: spanner_orm/metadata.py
from typing import Any, Dict, Type, Optional
from spanner_orm import error
from spanner_orm import field
from spanner_orm import foreign_key_relationship
from spanner_orm import index
from spanner_orm import registry
from spanner_orm import relationship

      self.indexes[index.Index.PRIMARY_INDEX] = primary_index
    self.primary_keys = self.indexes[index.Index.PRIMARY_INDEX].columns

    self.columns = [f.name for f in sorted_fields]

    for _, relation in self.relations.items():
      relation.origin = self.model_class
    registry.model_registry().register(self.model_class)
    self._finalized = True

  def add_metadata(self, metadata: 'ModelMetadata') -> None:
    self.table = metadata.table or self.table
    self.fields.update(metadata.fields)
    self.relations.update(metadata.relations)
    self.indexes.update(metadata.indexes)
    self.interleaved = metadata.interleaved or self.interleaved

  def add_field(self, name: str, new_field: field.Field) -> None:
    new_field.name = name
    new_field.position = len(self.fields)
    self.fields[name] = new_field

  def add_relation(self, name: str,
                   new_relation: relationship.Relationship) -> None:
    new_relation.name = name
    self.relations[name] = new_relation

  def add_foreign_key_relation(
      self,
      name: str,

      new_relation: foreign_key_relationship.ForeignKeyRelationship,