Don't open connection if not needed - symfony

I use Symfony with Doctrine. I use memcached. In some cases when results from DB are cached, there is no need to open a connection with Database. But Doctrine does it anyway. Is there a possibility no to open DB connection if there is no DB Query?

Related

SQLite can I commit transactions I do not own?

Consider a python webapp using SQLite and the DB Browser for SQLite app. Sometimes a database change (insert, update, delete) is made in DB Browser and not committed. This locks up the python web server if it saves to the same table.
I am wondering if there is an SQLite magic cookie that will allow me to commit any outstanding transaction. The concept doesn't leap to the imagination, but there is no "user". One simply attaches to the SQLite database. Technically, transactions are owned by anyone attached to that database.
My goal is to issue a "commit" from python to ensure the database status is nominal.
Any ideas?

Can Application Insights automatically track queries to Cosmos Db with connection mode Direct?

Currently in Application Insights we are only seeing these operations between our .Net Core application and Cosmos db
but queries to actually query and insert data is not seen. We are using Direct connection mode as per the performance tips https://learn.microsoft.com/en-us/azure/cosmos-db/performance-tips.
Do we have to manually track these queries or can this be done automatically, like when using Sql Server.
I turns out that queries to cosmos db using Direct connection mode are not automatically tracked, as stated here: https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-dependencies#automatically-tracked-dependencies
So all queries to Cosmos db must be tracked manually.

SQL always encrypted and dump of migration scripts for validation

I have two issues I can't figure out how to accomplish in Flyway without forking the repo and we'd like to avoid that.
Issue #1. Sql Server Always Encrypted connection, how do we override or inject enough information so that Flyway can setup the database connect to an Always Encrypted database. The connection needs to connect to Azure Key Vault to get a token for use for encryption/decryption but this additional setup that is above the the standard User Name/Password the connection string needs. Also, you can't pass these values on the connections string.
More details here on how this would be done in JDBC as I'm not a Java person.
Issue #2. Is there a way to retrieve the full list of SQL statements that are about to run during the migration and after all the "placeholders" are resolved? We need a way to check all the SQL scripts to ensure the scripts don't run specific commands such as CREATE USER, DROP DATABASE, etc. as we running this in a controlled environment and though that those commands work great during development, they can't be run in PRODUCTION. In Production the database user will have elevated privileges so we need to check the scripts before running them. I see the Dry Runs Pro feature but that just writes to a file. We'd like to get this data back on a callback and then we can validate it prior to the migration running.

Symfony2: Update schema with dynamic entity manager

I have a problem with updating database schema. I have a entity manager for connect to database via db name when user logging. I have two databases - db1 and db2. I want to update schema for each databases. Is it possible in doctrine?
Yes, it's possible, you need multiple connections defined in your config.yml. Check here http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html

Using redis with SQL server

I am developing a web app and came across redis for key value storage. I do have a relational db SQL server. But as I have a multi tenancy system there will be separate schemas for each customer.
I was thinking how viable would it be use both redis and SQL server together? I was thinking of storing user Id and schemas so then can connect to SQL server db for that user
It's perfectly viable to use both Redis and SQL Server together.
With more details about the kinds of schema differences you expect, we might be able to provide more insight.

Resources