docs: def export_mv_grid(self, session, mv_grid_districts):
          """ Exports MV grids to database for visualization purposes
  
          Parameters
          ----------
          session : sqlalchemy.orm.session.Session
              Database session
          mv_grid_districts : List of MV grid_districts (instances of MVGridDistrictDing0 class)
              whose MV grids are exported.
  
          Returns
          -------
          int
              Description #TODO
          """
  
          # check arguments
          if not all(isinstance(_, int) for _ in mv_grid_districts):
              raise TypeError('`mv_grid_districts` has to be a list of integers.')
  
          srid = str(int(cfg_ding0.get('geo', 'srid')))
  
          # delete all existing datasets
          # db_int.sqla_mv_grid_viz.__table__.create(conn) # create if not exist
          # change_owner_to(conn,
          #                 db_int.sqla_mv_grid_viz.__table_args__['schema'],
          #                 db_int.sqla_mv_grid_viz.__tablename__,
          #                 'oeuser')
          session.query(db_int.sqla_mv_grid_viz).delete()
          session.commit()
  
          # build data array from MV grids (nodes and branches)
          for grid_district in self.mv_grid_districts():
  
              grid_id = grid_district.mv_grid.id_db
  
              # init arrays for nodes
              mv_stations = []
              mv_cable_distributors = []
              mv_circuit_breakers = []
              lv_load_area_centres = []
              lv_stations = []
              mv_generators = []
              lines = []
  
              # get nodes from grid's graph and append to corresponding array
              for node in grid_district.mv_grid._graph.nodes():
                  if isinstance(node, LVLoadAreaCentreDing0):
                      lv_load_area_centres.append((node.geo_data.x, node.geo_data.y))
                  elif isinstance(node, MVCableDistributorDing0):
                      mv_cable_distributors.append((node.geo_data.x, node.geo_data.y))
                  elif isinstance(node, MVStationDing0):
                      mv_stations.append((node.geo_data.x, node.geo_data.y))
                  elif isinstance(node, CircuitBreakerDing0):
                      mv_circuit_breakers.append((node.geo_data.x, node.geo_data.y))
                  elif isinstance(node, GeneratorDing0):
                      mv_generators.append((node.geo_data.x, node.geo_data.y))
  
              # create shapely obj from stations and convert to
              # geoalchemy2.types.WKBElement
              # set to None if no objects found (otherwise SQLAlchemy will throw an error).
              if lv_load_area_centres:
                  lv_load_area_centres_wkb = from_shape(MultiPoint(lv_load_area_centres), srid=srid)
              else:
                  lv_load_area_centres_wkb = None
  
              if mv_cable_distributors:
                  mv_cable_distributors_wkb = from_shape(MultiPoint(mv_cable_distributors), srid=srid)
              else:
                  mv_cable_distributors_wkb = None
  
              if mv_circuit_breakers:
                  mv_circuit_breakers_wkb = from_shape(MultiPoint(mv_circuit_breakers), srid=srid)
              else:
                  mv_circuit_breakers_wkb = None
  
              if mv_stations:
                  mv_stations_wkb = from_shape(Point(mv_stations), srid=srid)
              else:
                  mv_stations_wkb = None
  
              if mv_generators:
                  mv_generators_wkb = from_shape(MultiPoint(mv_generators), srid=srid)
              else:
                  mv_generators_wkb = None
  
              # get edges (lines) from grid's graph and append to corresponding array
              for branch in grid_district.mv_grid.graph_edges():
                  line = branch['adj_nodes']
                  lines.append(((line[0].geo_data.x,
                                 line[0].geo_data.y),
                                (line[1].geo_data.x,
                                 line[1].geo_data.y)))
  
              # create shapely obj from lines and convert to
              # geoalchemy2.types.WKBElement
              mv_lines_wkb = from_shape(MultiLineString(lines), srid=srid)
  
              # get nodes from lv grid districts and append to corresponding array
              for lv_load_area in grid_district.lv_load_areas():
                  for lv_grid_district in lv_load_area.lv_grid_districts():
                      station = lv_grid_district.lv_grid.station()
                      if station not in grid_district.mv_grid.graph_isolated_nodes():
                          lv_stations.append((station.geo_data.x, station.geo_data.y))
              lv_stations_wkb = from_shape(MultiPoint(lv_stations), srid=srid)
  
              # add dataset to session
              dataset = db_int.sqla_mv_grid_viz(
                  grid_id=grid_id,
                  geom_mv_station=mv_stations_wkb,
                  geom_mv_cable_dists=mv_cable_distributors_wkb,
                  geom_mv_circuit_breakers=mv_circuit_breakers_wkb,
                  geom_lv_load_area_centres=lv_load_area_centres_wkb,
                  geom_lv_stations=lv_stations_wkb,
                  geom_mv_generators=mv_generators_wkb,
                  geom_mv_lines=mv_lines_wkb)
              session.add(dataset)
  
          # commit changes to db
          session.commit()
  
          # logger.info('=====> MV Grids exported')
          logger.info('MV Grids exported')