Feat/add xero connector#14
Merged
Merged
Conversation
- 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 improved query performance.
…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.
…for enhanced data retrieval from Xero API.
…or enhanced overpayment 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.
…enhance data retrieval efficiency.
…ary, BudgetSummary, ExecutiveSummary, ProfitLoss, and TrialBalance
…arison_conditions function and return empty list for unsupported conditions in Project class.
…istency in data handling
…les to enhance usability
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…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>
…y/mindsdb into feat/add-xero-connector
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…le.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y/mindsdb into feat/add-xero-connector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
Verification Process
To ensure the changes are working as expected:
Additional Media:
Checklist: