Skip to content

Feat/add xero connector#14

Merged
gabrielbressan-tfy merged 36 commits into
mainfrom
feat/add-xero-connector
Nov 5, 2025
Merged

Feat/add xero connector#14
gabrielbressan-tfy merged 36 commits into
mainfrom
feat/add-xero-connector

Conversation

@gabrielbressan-tfy

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change and the issue it solves.

Fixes #issue_number

Type of change

(Please delete options that are not relevant)

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ⚡ New feature (non-breaking change which adds functionality)
  • 📢 Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • 📄 This change requires a documentation update

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Additional Media:

  • I have attached a brief loom video or screenshots showcasing the new functionality or change.

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

- Implemented XeroHandler for OAuth2 authentication and API interaction.
- Created requirements.txt for necessary dependencies (xero-python, requests).
- Developed XeroTable base class and specific table classes for Budgets, Contacts, Invoices, Items, Overpayments, Payments, Purchase Orders, Quotes, Repeating Invoices, and Accounts.
- Each table class includes methods for fetching data from the Xero API and executing SELECT queries.
…ion; add connection parameters for access and refresh tokens, and implement logic for token validation and refresh.
…on for token refresh and improve error handling in token retrieval. Update Xero tables to use xero_tenant_id for API calls and refactor query execution logic.
… condition parsing, value formatting, and SQL operator mapping for improved data retrieval and filtering.
… implement logic for loading and storing tokens, ensuring compatibility with Xero's rotating refresh token pattern. Update token expiration handling to use timezone-aware datetime.
…icate registration and optimize table initialization.
…r names for Xero API compatibility; include contact_id and improve column definitions for better data handling.
…pdate QuotesTable filter parameters for consistency and clarity.
…ions; refactor XeroHandler to register new tables and improve data handling.
…upsTable, ContactsTable) and enhance AccountsTable, BankTransactionsTable, and QuotesTable with improved filtering and sorting capabilities; remove BankTransfersTable.
…efactor ContactGroupsTable to fetch contact groups instead of budgets.
…e and CreditNotesTable with improved filter definitions and parameter mappings.
…hem in XeroHandler for enhanced data handling.
…atements; add PaymentsTable implementation for enhanced payment data handling.
… data from Xero API; define supported filters and column mappings.
…tsTable; implement PrepaymentsTable and PurchaseOrdersTable for enhanced data handling from Xero API.
…e, date, Enum, dict, and list types to enhance data handling.
…ler for enhanced invoice management from Xero API.
…ary, BudgetSummary, ExecutiveSummary, ProfitLoss, and TrialBalance
…arison_conditions function and return empty list for unsupported conditions in Project class.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Xero connector to MindsDB, enabling read-only access to Xero Accounting API data through SQL queries. The connector supports OAuth2 authentication with automatic token refresh and provides access to 10+ accounting endpoints including invoices, contacts, payments, and financial reports.

Key Changes:

  • New Xero handler implementation with OAuth2 token management and automatic refresh
  • Support for 17 Xero API tables (accounts, invoices, contacts, reports, etc.) with query optimization
  • Enhanced SQL utilities to handle TypeCast nodes and configurable default limits

Reviewed Changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
mindsdb/interfaces/database/projects.py Added fallback return for unsupported WHERE conditions to prevent crashes
mindsdb/integrations/utilities/sql_utils.py Added TypeCast unwrapping to support type-casted identifier comparisons
mindsdb/integrations/utilities/handlers/query_utilities/select_query_utilities.py Added use_default_limit parameter to support tables that need all records by default
mindsdb/integrations/handlers/xero_handler/xero_tables.py Base table class with common functionality for flattening nested responses and building Xero WHERE clauses
mindsdb/integrations/handlers/xero_handler/xero_report_tables.py Base class for parsing hierarchical Xero report structures into flat DataFrames
mindsdb/integrations/handlers/xero_handler/xero_handler.py Main handler with OAuth2 flow, token injection, and automatic token refresh with race condition protection
mindsdb/integrations/handlers/xero_handler/tables/*.py 17 table implementations for Xero entities (invoices, contacts, payments, reports)
mindsdb/integrations/handlers/xero_handler/requirements.txt Dependencies for xero-python SDK
mindsdb/integrations/handlers/xero_handler/connection_args.py Connection parameter definitions for OAuth2 and token injection
mindsdb/integrations/handlers/xero_handler/init.py Handler registration
mindsdb/integrations/handlers/xero_handler/README.md Comprehensive documentation with setup and usage examples
default_handlers.txt Added xero to the default handlers list
config.json MindsDB configuration file (unrelated to Xero connector)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mindsdb/integrations/handlers/xero_handler/tables/items_table.py Outdated
Comment thread mindsdb/integrations/handlers/xero_handler/tables/journals_table.py Outdated
Comment thread mindsdb/integrations/handlers/xero_handler/tables/bank_transactions_table.py Outdated
Comment thread mindsdb/integrations/handlers/xero_handler/tables/bank_transfers_table.py Outdated
Comment thread mindsdb/integrations/handlers/xero_handler/tables/invoices_table.py Outdated
Comment thread mindsdb/integrations/handlers/xero_handler/xero_handler.py Outdated
Comment thread config.json Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
gabrielbressan-tfy and others added 8 commits November 5, 2025 17:06
…le.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tions_table.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rs_table.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…le.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gabrielbressan-tfy gabrielbressan-tfy marked this pull request as ready for review November 5, 2025 21:09
@gabrielbressan-tfy gabrielbressan-tfy merged commit 7abebb8 into main Nov 5, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants