feat: add column with load from db#9932
feat: add column with load from db#9932erichare merged 2 commits intofeat/global_variables_tablefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
* implement allowCustomValue to not show editor when prop is false * changed to get table schema correctly * Made table component not be editable when it doesn't have the onCellValueChanged * Add condition to render global variable fields * added allowCustomValue props * added load from db props into column that comes from backend * add load from db into column context, set column as not editable and without border when its global variable * Changed group class to be compatible with global variable in table input * feat: add column with load from db (#9932) * add column with load from db * Update test_table_loader_component.py --------- Co-authored-by: Eric Hare <ericrhare@gmail.com> * Test and ruff updates * Update test_table_schema_demo_component.py * refactor: move table schma to lfx This commit refactors the `table.py` file by consolidating imports from `lfx.schema.table` and removing several unused classes and definitions, including `FormatterType`, `EditMode`, `Column`, `FieldValidatorType`, `FieldParserType`, and `TableOptions`. The changes streamline the codebase and improve maintainability. * fix: add noqa comment for password field in FieldValidatorType This commit adds a comment to the PASSWORD field in the FieldValidatorType enum to suppress a specific linting warning, ensuring code quality while maintaining clarity in the validation schema. * refactor: update imports for table schema components This commit refactors the import statements in `table_schema_demo_component.py` and `test_table_schema_demo_component.py` to source the `Column` class from `lfx.schema.table` instead of `langflow.schema.table`, aligning with recent changes in the codebase structure. * feat: implement loading global variables into table inputs (#10001) * feat: add support for table field handling in ParameterHandler This commit introduces a new method, _handle_table_field, in the ParameterHandler class to manage table field types. It validates input values, processes load_from_db columns, and stores relevant metadata for later database loading. This enhancement improves the flexibility and robustness of parameter handling in the codebase. * feat: implement async table parameter updates with database fallback This commit introduces the `update_table_params_with_load_from_db_fields` function, which asynchronously updates parameters for table fields by loading values from the database or falling back to environment variables. The function enhances the handling of table data within the parameter loading process, improving flexibility and robustness in managing dynamic configurations. * feat: enhance unit tests for parameter updates with database and environment fallback This commit updates the unit tests in `test_loading.py` to utilize the newly aliased `langflow_update_params` function and introduces comprehensive tests for the `update_table_params_with_load_from_db_fields` function. The tests cover various scenarios, including fallback mechanisms for both database and environment variables, ensuring robust handling of table data and error conditions. * feat: add unit tests for ParameterHandler's load_from_db functionality This commit introduces a new test suite for the `ParameterHandler` class, specifically focusing on the `_handle_table_field` method. The tests cover various scenarios, including handling of load_from_db columns, empty schemas, and invalid data types, ensuring robust validation and processing of table field parameters. This enhancement improves the reliability of parameter handling in the codebase. * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * fix: update _handle_table_field to support load_from_db_fields parameter * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Update index.tsx * Update tests * Update test_loading.py * Update test_vertex_base.py * [autofix.ci] apply automated fixes * fix: use global param handler load from db fields * Update param_handler.py * Update param_handler.py * Update param_handler.py * Update test_loading.py * Update test_loading.py * Update test_loading.py * Update test_loading.py * Update test_loading.py * Update test_loading.py * Update Image Sentiment Analysis.json * Update Hybrid Search RAG.json * [autofix.ci] apply automated fixes * Update Hybrid Search RAG.json * Update Hybrid Search RAG.json * Template updates * Update starter-projects.spec.ts * Update Knowledge Ingestion.json * fixed styling * fixed columns not getting from right place * fixed instagram copywriter * Update Market Research.spec.ts --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: Eric Hare <ericrhare@gmail.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>



This pull request introduces support for specifying whether a table column's default value should be loaded from global variables using a new
load_from_dbattribute in theColumnschema. It also adds a demo component and comprehensive tests to showcase and validate this functionality, ensuring both static and dynamic defaults are handled correctly.Schema enhancements:
load_from_dbto theColumnmodel insrc/backend/base/langflow/schema/table.py, allowing columns to specify if their default should be loaded from global variables.Component and demo:
TableSchemaDemoComponentinsrc/backend/tests/unit/components/data/table_schema_demo_component.pyto demonstrate and test table columns with theload_from_dbattribute, including logic for processing table data and extracting schema info.Testing:
src/backend/tests/unit/components/data/test_table_schema_demo_component.pyto validate the demo component's behavior, including initialization, schema configuration, data loading (with various row types), output methods, and integration for serialization and schema correctness.src/backend/tests/unit/components/data/test_table_loader_component.pyfor further validation of the demo component and schema serialization, ensuring robustness and compatibility.src/backend/tests/unit/io/test_table_schema.pywith tests for theload_from_dbattribute, covering default values, explicit settings, and mixed column configurations.