title: How to create a route with python and flask based on user input?
body: <p>I am using python with flask as a backend and I am trying to create a route to a table in my database based on user input. During one of my post requests a table is created in the database. I then want to create a connection to this table. The table name also depends on user input. I want to emphasize that I am able to create the tables in the database based on user input and now need to create the route to these tables.
  Is there a way to create such route?
  I understand that doing something like this may lead to security vulnerability so I am open to suggestions for different approaches.</p>
  <p>I am attaching below my current python code for creating routes:</p>
  <pre><code># Destination Class/model
  class Destinations(db.Model):
      ID = db.Column(db.Integer, primary_key=True)
      city = db.Column(db.String(100))
      country = db.Column(db.String(100))
  
      def __init__(self, city, country):
          self.city = city
          self.country = country
  
  # Destinations Schema
  class DestinationsSchema(ma.Schema):
      class Meta:
          fields = ('ID', 'city', 'country')
  
  # Init Destinations Schema
  destination_schema = DestinationsSchema()
  destinations_schema = DestinationsSchema(many=True)
  
  # Create a Destination
  @app.route('/destinations', methods=['POST'])
  def add_destination():
      city = request.json['city']
      country = request.json['country']
  
      new_destination = Destinations(city, country)
  
      db.session.add(new_destination)
      db.session.commit()
  
      return destination_schema.jsonify(new_destination)
  
  # Get All Destinations
  @app.route('/destinations', methods=['GET'])
  def get_destinations():
      all_destinations = Destinations.query.all()
      result = destinations_schema.dump(all_destinations)
      return jsonify(result)
  </code></pre>