<!--
title: Feature flags over vendors
domain: app-frameworks
topic: Configurations
language: Python
source: django/django
updated: 2025-05-14
url: https://awesomereviewers.com/reviewers/django-feature-flags-over-vendors/
-->

When checking for database backend capabilities, always use feature flags rather than checking specific vendor names. This makes your code more maintainable and vendor-agnostic while allowing third-party backends to implement support through the feature flag system.

Instead of explicitly checking the vendor:

```python
if connection.vendor == "sqlite":
    # SQLite-specific implementation
    ...
else:
    # Implementation for other databases
    ...
```

Declare and use feature flags:

```python
# In database feature definition
class DatabaseFeatures:
    supports_json_absent_on_null = property(lambda self: self.connection.vendor != "sqlite")

# In your code
if connection.features.supports_json_absent_on_null:
    # Use feature requiring JSON ABSENT ON NULL
    ...
else:
    # Use alternative implementation or raise NotSupportedError
    raise NotSupportedError("This database does not support ABSENT ON NULL")
```

This pattern centralizes capability detection in feature flags rather than spreading vendor-specific checks throughout the codebase, making it easier to update support for features across different database backends.
