title: "Oracle "alter session set" via flask-sqlalchemy and cx-oracle"
body: <p>how can I start a connection to an oracle database using flask-sqlalchemy and cx-oracle by sending these parameters:</p>
  
  <pre><code>alter session set nls_comp=linguistic;
  alter session set nls_sort=Latin_AI;
  </code></pre>
  
  <p>In order to be able to make queries and sorts that do not distinguish, for example, between "Jose" and "José"</p>
  
  <p>That's how I usually make the connection:</p>
  
  <pre><code>import os
  from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from config import config
  
  def create_app(config_name=(os.getenv('FLASK_CONFIG') or 'default')):
      app = Flask(__name__)
      app.config.from_object(config[config_name])
  
  db.init_app(app)
  
  from commons import commons_bp
  from admin import admin_bp
  from inventario import inventario_bp
  from incidencias import incidencias_bp
  from inconformidades import inconformidades_bp
  
  with app.app_context():
  
      app.register_blueprint(commons_bp)
      app.register_blueprint(admin_bp)
      app.register_blueprint(inventario_bp)
      app.register_blueprint(incidencias_bp)
      app.register_blueprint(inconformidades_bp)
  
  return app
  </code></pre>
  
  <p>and the configuration:</p>
  
  <pre><code>class DevelopmentConfig(Config):
      TESTING = True
      DEBUG = True
      SQLALCHEMY_ECHO = os.environ.get('SQLALCHEMY_ECHO') or False
      SQLALCHEMY_POOL_SIZE = None
      SQLALCHEMY_POOL_TIMEOUT = None
      SQLALCHEMY_BINDS = {
          'adminapps': 'oracle://ADMINAPPS:ADMINAPPS@SERVIDOR53/ENTECO',
          'incidencias': 'oracle://INCIDENCIAS:INCIDENCIAS@SERVIDOR53/ENTECO',
          'incidencias': 'oracle://INCIDENCIAS:INCIDENCIAS@SERVIDOR53/ENTECO',
          'inventario': 'oracle://INVENTARIO:INVENTARIO@SERVIDOR53/ENTECO',
          'inconformidades': 'oracle://INCONFORMIDADES:INCONFORMIDADES@SERVIDOR53/ENTECO',
          'documentacion': 'oracle://DOCUMENTACION:DOCUMENTACION@SERVIDOR53/ENTECO',
          'auditoria': 'oracle://AUDITORIA:AUDITORIA@SERVIDOR53/ENTECO',
          'navision': 'mssql+pyodbc://DB:DB.2020@SERVIDOR52',
      }
  </code></pre>
  
  <p>I've tried among other things:</p>
  
  <pre><code>'adminapps': ['oracle://ADMINAPPS:ADMINAPPS@SERVIDOR53/ENTECO', 'alter session set "nls_comp"="linguistic"', 'alter session set "nls_sort"="Latin_AI"'],
  </code></pre>
  
  <p>But I haven't been successful, I can't figure out how to do it, thank you for your answers!</p>