{"id":6453,"library":"semantic-link-functions-validators","title":"Semantic Link Functions - Validators","description":"Semantic Link Functions - Validators is a Python library that extends Microsoft FabricDataFrames with semantic validation capabilities. It provides built-in functions for validating common data types such as email addresses and credit card numbers, leveraging the underlying 'validators' Python package. This library is part of the broader Microsoft Fabric semantic link ecosystem, enabling enhanced data quality within data science workflows in Fabric notebooks. It is actively maintained, with the current version being 0.14.0.","status":"active","version":"0.14.0","language":"en","source_language":"en","source_url":"https://github.com/microsoft/semantic-link-functions","tags":["microsoft fabric","semantic link","sempy","data validation","dataframe","pbi","data quality"],"install":[{"cmd":"pip install semantic-link-functions-validators","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the core validation logic for data types like email and credit card numbers.","package":"validators","optional":false},{"reason":"Meta-package for the Semantic Link ecosystem, often installed alongside. While 'semantic-link-functions-validators' can be installed independently, its full functionality is realized within the Semantic Link/SemPy environment which provides FabricDataFrames.","package":"semantic-link","optional":true},{"reason":"The core Python library for Semantic Link (SemPy) which provides the FabricDataFrame structure and mechanisms for semantic functions.","package":"sempy","optional":false}],"imports":[{"note":"Validation functions are exposed dynamically on FabricDataFrames. Ensure 'sempy' is installed and available.","symbol":"FabricDataFrame","correct":"from sempy.fabric import FabricDataFrame"}],"quickstart":{"code":"import pandas as pd\nfrom sempy.fabric import FabricDataFrame\n\n# NOTE: This code is intended to be run within a Microsoft Fabric notebook\n# where semantic link is initialized. Running outside might require additional setup.\n# For demonstration, we simulate a FabricDataFrame.\n\ntry:\n    df = FabricDataFrame({\n        'email_column': ['test@example.com', 'invalid-email', 'another@domain.co'],\n        'cc_number': ['1234-5678-9012-3456', '1111-2222-3333', '4567-8901-2345-6789']\n    })\n    \n    # Apply semantic validation functions directly to the DataFrame columns\n    df['is_valid_email'] = df['email_column'].is_email()\n    df['is_valid_cc'] = df['cc_number'].is_credit_card()\n    \n    print(df)\n    \nexcept ImportError:\n    print(\"Please ensure 'semantic-link-functions-validators' and 'sempy' are installed.\")\n    print(\"Also, consider running this in a Microsoft Fabric environment for full functionality.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to use `semantic-link-functions-validators` to validate email addresses and credit card numbers within a `FabricDataFrame`. The validation functions (`is_email`, `is_credit_card`) are called directly as methods on the DataFrame series. This example is designed for use within a Microsoft Fabric notebook environment where `FabricDataFrame` is available and semantic link is active."},"warnings":[{"fix":"Downgrade pandas to a version below 3.0, or ensure you are using a compatible version of 'semantic-link' (e.g., semantic-link >= 0.13.1 or semantic-link-sempy >= 0.9.4) which includes a fix. Alternatively, install 'semantic-link-sempy' instead of the full 'semantic-link' meta-package if you only need core SemPy functionalities and individual function packages.","message":"The broader 'semantic-link' meta-package (and 'semantic-link-sempy') has reported breaking compatibility with 'pandas >= 3.0', leading to 'AttributeError: 'types.SimpleNamespace' object has no attribute 'suffixes''. As 'semantic-link-functions-validators' integrates with 'FabricDataFrame' (a pandas subclass), this incompatibility may affect its usage if 'pandas 3.0+' is in the environment with older 'semantic-link' or 'sempy' versions.","severity":"breaking","affected_versions":"semantic-link < 0.13.1, semantic-link-sempy < 0.9.4 when used with pandas >= 3.0"},{"fix":"For full functionality and integration, run this library within a Microsoft Fabric notebook. Ensure the appropriate Fabric runtime (Spark 3.4+) is used, where 'semantic-link' may be preinstalled or easily updated.","message":"This library is primarily designed for use within Microsoft Fabric notebooks and leverages the `FabricDataFrame` structure and semantic link's environment. While the `FabricDataFrame` can be instantiated locally (as shown in the quickstart for demonstration), some functionalities, especially those involving metadata propagation or interaction with Power BI semantic models, might require a genuine Fabric environment for full operation and discovery of semantic functions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check Microsoft Fabric documentation for current authentication best practices. Consider downgrading the `semantic-link-sempy` package to a stable version (e.g., 0.9.3 was mentioned as a workaround in some cases) or ensuring the workspace environment is correctly configured to provide valid tokens.","message":"Authentication issues (403 errors) have been reported when using `sempy.fabric` functions, which `semantic-link-functions-validators` relies upon. This can stem from environment context or token acquisition problems within Fabric notebooks.","severity":"gotcha","affected_versions":"Specific versions of `semantic-link-sempy`, notably around 0.9.3 and later if not correctly configured."}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}