[general]
name=Databricks DBSQL Connector
qgisMinimumVersion=3.16
qgisMaximumVersion=4.99
description=Connect QGIS to Databricks SQL warehouses and access geospatial data directly from Unity Catalog
version=1.8.0
author=Danny Wong
email=danny.wong@databricks.com

# Required URLs
homepage=https://github.com/danny-db/qgis-databricks-connector
repository=https://github.com/danny-db/qgis-databricks-connector
tracker=https://github.com/danny-db/qgis-databricks-connector/issues

# Plugin icon (relative to plugin folder)
icon=icons/databricks.svg

# Tags for discoverability in plugin manager
tags=databricks,database,sql,warehouse,geospatial,unity catalog,spatial,vector,live layer,viewport,genie,natural language,chat

# Category - Database is most appropriate for this plugin
category=Database

# License - MIT is GPL-compatible
license=MIT

# Plugin flags
experimental=False
deprecated=False
server=False

# Detailed description with dependency information
about=A QGIS plugin that provides direct connectivity to Databricks SQL warehouses, allowing you to load and display geospatial data from Unity Catalog tables directly in QGIS.

    Features:
    - Direct Databricks SQL connection using personal access tokens or OAuth (browser login / SSO)
    - Full support for GEOGRAPHY and GEOMETRY data types
    - Live Layers: viewport-based auto-refresh for working with large datasets
    - Browser Panel integration for browsing catalogs, schemas, and tables
    - Custom SQL query support with automatic geometry detection
    - Automatic handling of mixed geometry types (creates separate layers)
    - Configurable layer naming with persistent settings
    - Genie Agent: ask a Genie Agent questions about your data in natural language
    - Genie One: ask questions across your whole workspace via the Genie One API
    - Connection management with saved credentials
    - QGIS 3.x and 4.x compatible (Qt5 and Qt6)

    Requirements:
    - Databricks SQL Warehouse access
    - Authentication: a Personal Access Token, or OAuth (browser login / SSO)
    - Unity Catalog tables with GEOGRAPHY or GEOMETRY columns

    Python Dependencies (installed automatically):
    - databricks-sql-connector>=3.5.0 (required)

    For installation instructions and documentation, visit the GitHub repository.

# Changelog
changelog=1.8.0 - Lakehouse Real-Time warehouses
    - New: connect to Lakehouse Real-Time SQL warehouses; every feature works on them
      (Discover Tables, Browser panel, Custom Query and Save in project, live layers,
      Update Layer Data, Genie, Explain this Map), with OAuth or a personal access token
    - New: one-click install of the Databricks SQL kernel Real-Time warehouses use,
      offered from Sign in, Test Connection, Discover Tables and the Browser panel; no restart
    - Improved: OAuth on Real-Time warehouses reuses the plugin's saved sign-in
    - Improved: geometry from Real-Time warehouses appears as on standard warehouses

    1.7.1 - Installer and documentation tidy-up
    - Improved: the dependency installer uses the standard databricks-sql-connector package
    - Lakehouse Real-Time warehouse support is planned for a later release
    - Docs: README use cases and a full CHANGELOG.md

    1.7.0 - Explain this Map with frontier models on Databricks
    - New: Explain this Map: one click sends the current map to a frontier model on your
      Databricks workspace (Foundation Model APIs) and streams back an explanation
    - New: no API key or extra subscription: uses your existing Databricks sign-in
    - New: model picker (image-capable models on your workspace), prompt presets (explain,
      report summary, patterns, caption and alt text, next steps) and custom prompts
    - New: follow-up questions, copy, and save as Markdown with the map image
    - The map's facts (area, scale, layers and what each style encodes) are sent with the
      image so answers use your real layer and field names
    - Improved: OAuth sign-ins renew well ahead of expiry, so long Genie One and Explain
      this Map sessions run without interruption
    - Improved: busy maps (for example with a detailed basemap) are sent as JPEG so they
      always fit the model's image limit
    - Improved: Genie Agent and Genie One toolbar buttons use the official Genie icons

    1.6.1 - Simpler, more secure project sharing; summary-table layers
    - Improved: every Databricks layer now links to your saved connection by name, so
      projects carry only the connection details and are easier to share with your team
    - Improved: projects from earlier versions are upgraded automatically when opened
    - Improved: credentials for connections you haven't saved stay in memory for the session
    - New: Custom Query "Add as Layer" now also creates layers from queries without a
      geometry column (e.g. summary tables)

    1.6.0 - Save custom SQL queries as project layers (issue #3)
    - New: Custom Query "Save in project" — the query is saved in the .qgz and
      re-queries Databricks when the project opens (like PostGIS SQL layers)
    - New: project layers fetch only the visible map area; select, identify and refresh work
    - Improved: project layers link to your saved connection by name, so projects are easy to share
    - Fixed: Databricks data provider (GEOMETRY(n)/GEOGRAPHY(n) columns, extent, Multi* types)

    1.5.1 - Security hardening and Qt6 readiness
    - Improved: stronger SQL handling: table and column names of any kind are quoted
      safely, and live-layer map extents are sent as query parameters
    - Improved: all Databricks API calls use HTTPS
    - Improved: clearer diagnostics in the QGIS log
    - Improved: modern Qt6 code throughout, so one plugin runs natively on QGIS 3 and QGIS 4
    - Passes the QGIS plugin site security and Qt6 checks; tested on QGIS 3.44 and 4.2.3

    1.5.0 - Genie One + Genie Agent rename
    - New: Databricks Genie One dialog — ask questions across the whole workspace
      (no Genie Agent to pick) via the Genie One MCP server on Unity Gateway
    - New: live progress steps, Cancel, multiple query results, Open in Databricks link
    - New: Genie One results with geometry can be added as map layers
    - New: Genie charts shown inline in the chat for Genie Agent (Genie's rendered image)
      and Genie One (Genie One's chart spec, drawn natively); Save Chart as PNG
    - New: works with Personal Access Token and OAuth sign-in
    - Changed: "Databricks Genie Chat" renamed to "Databricks Genie Agent"

    1.4.0 - OAuth (browser login / SSO) authentication
    - New: Auth Method selector — choose Personal Access Token or OAuth (U2M)
    - New: OAuth User-to-Machine browser sign-in; no Personal Access Token required
    - New: "Sign in" button primes the OAuth flow so the browser opens only once
    - New: OAuth tokens cached in a permission-restricted file under the QGIS profile,
      so connections, live-layer refreshes, the Browser panel and Genie reuse them silently
    - New: Genie REST calls obtain a bearer token from the cached OAuth session
    - Changed: all connections now flow through a single auth factory (databricks_auth.py)
    - Back-compat: existing Personal Access Token connections and layers keep working unchanged

    1.3.1 - Fix dependency installation on QGIS 4 macOS
    - Fixed: thrift build failure caused by pip build isolation spawning broken subprocess
    - Fixed: "Couldn't load SIP module" error during dependency installation
    - Fixed: QGIS opening a second instance during pip install
    - Added --no-build-isolation flag for in-process pip to prevent subprocess spawning
    - Added PYTHONPATH scrubbing to prevent QGIS paths leaking into build subprocesses

    1.3.0 - Genie Chat (natural language data queries)
    - New: Databricks Genie Chat dialog — ask questions in plain English
    - New: Genie Space browser with auto-populated space list
    - New: Thinking indicator with animated dots, elapsed timer, and Cancel button
    - New: Smart geometry hints — instructs Genie to return geometry as a typed column
    - New: Collapsible SQL panel (hidden by default) with Show SQL / Copy SQL buttons
    - New: Markdown rendering for Genie responses (bold, italic, bullets, code)
    - New: Query results preview table (up to 100 rows)
    - New: Auto-detect geometry columns and create QGIS layers from Genie results
    - New: Supports WKT and non-WKT geometry (auto-wraps with ST_ASWKT)
    - New: Follow-up questions within the same Genie conversation
    - New: Toolbar button and menu item for quick access
    - New: Dark mode compatible — explicit text colours for readability
    - New: Qt6 shims for QSizePolicy and QAbstractItemView enums

    1.2.0 - Live layers + QGIS 4 / Qt6 compatibility
    - New: Live Layer mode with viewport-based auto-refresh (pan/zoom to load data)
    - New: Mixed geometry detection for live layers (creates separate layers per type)
    - New: Auto-centre map on first live layer load
    - New: Smart debounce and extent similarity checks to minimise queries
    - New: Toggle live mode on/off via Plugins menu
    - New: QGIS 4.0 (Qt6/PyQt6) support while maintaining QGIS 3.16+ compatibility
    - New: Qt5/Qt6 compatibility shim module (_qt6_compat.py)
    - Fixed: Plugin load failures caused by removed Qt5 unscoped enums
    - Fixed: Dependency installation on QGIS 4 macOS (switched to in-process pip)
    - Fixed: Replaced deprecated exec_() with exec()
    - Fixed: Hardcoded PyQt5 import replaced with portable qgis.PyQt abstraction

    1.1.1 - Security improvements
    - Security: Use parameterized queries for information_schema lookups
    - Security: Added documentation for escaped SQL identifiers
    
    1.1.0 - Layer refresh and bug fixes
    - New: Update Layer Data from Databricks menu option
    - New: Multi-layer refresh support (select multiple layers)
    - Fixed: Column names with spaces now work correctly
    - Fixed: Polygon/MultiPolygon layers load correctly from Browser
    - Fixed: DateTime fields handled properly across all methods
    - Improved: Consistent behavior between Dialog and Browser panel
    
    1.0.0 - Initial release
    - Direct Databricks SQL warehouse connectivity
    - Browser Panel integration for browsing Unity Catalog
    - Custom SQL query dialog with database structure browser
    - Support for GEOGRAPHY and GEOMETRY data types
    - Automatic mixed geometry detection and layer separation
    - Configurable layer prefix and feature limits
    - Connection management with persistent settings
