Activity
Mon
Wed
Fri
Sun
Oct
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
What is this?
Less
More

Memberships

Learn Microsoft Fabric

12.7k members β€’ Free

2 contributions to Learn Microsoft Fabric
A Small Gotcha with Fabric UDF Parameters
When building a function explorer in Python for Fabric, everything worked fine during local testing, but publishing the UDF failed. The reason? Fabric enforces stricter rules on UDF input parameter names than the test environment does. Specifically, input parameters cannot contain underscores (_). When testing translytical features in Fabric, especially using the new Functions explorer, these stricter naming rules apply, so what works locally might not publish successfully. Renaming parameters (e.g., start_time β†’ startTime) fixed the issue immediately. This is a small but important detail that can save time and frustration when trying out the new Functions explorer.
2 likes β€’ Aug 26
Thaks for the feedback @Will Needham. I am attaching both the code that failed and the one that worked during publishing, in case my previous description was inaccurate. When the function definitions are written with an underscore it fails: activity_name: str, forecast_value: float, comment_text: str, user_name: str -> This one fails: import fabric.functions as fn udf = fn.UserDataFunctions() @udf.connection(argName="sqlDB", alias="translyticaltes") @udf.function() def write_activity_to_sql_db( sqlDB: fn.FabricSqlConnection, activity_name: str, forecast_value: float, comment_text: str, user_name: str ) -> str: try: conn = sqlDB.connect() cursor = conn.cursor() insert_query = "INSERT INTO dbo.Activities (Activity, Forecast, Comment, Modified_By_Name, Modified_Date) VALUES (?, ?, ?, ?, GETDATE());" cursor.execute( insert_query, (activity_name, forecast_value, comment_text, user_name) ) conn.commit() return f"Data lagt til: {activity_name} ({forecast_value}) av {user_name}" except Exception as e: return f"Feil: {str(e)}" finally: if 'cursor' in locals() and cursor: cursor.close() if 'conn' in locals() and conn: conn.close() ----------------- And this one works: import fabric.functions as fn udf = fn.UserDataFunctions() @udf.connection(argName="sqlDB", alias="translyticaltes") @udf.function() def write_activity_to_sql_db( sqlDB: fn.FabricSqlConnection, activityname: str, forecastvalue: float, commenttext: str, username: str ) -> str: try: conn = sqlDB.connect() cursor = conn.cursor() insert_query = "INSERT INTO dbo.Activities (Activity, Forecast, Comment, Modified_By_Name, Modified_Date) VALUES (?, ?, ?, ?, GETDATE());" cursor.execute( insert_query, (activityname, forecastvalue, commenttext, username) ) conn.commit() return f"Data lagt til: {activityname} ({forecastvalue}) av {username}" except Exception as e: return f"Feil: {str(e)}" finally: if 'cursor' in locals() and cursor:
Whenever you are asked to select a Region, stop and think!
There are many places where you can be asked to select a Region in Fabric, or in Azure more generally. So I recommend, always stopping and thinking about the region you select (do research on the topic, before you choose), because the selection you make can sometimes have quite a big impact on functionality/ user experience. Here's some very common places where you need to specify a region, and where making the wrong decision, can cause issues: - When you set up your Fabric free trial - make sure you select a Region that is supported. You can find which region you are currently in (in Microsoft's world) - using this link. - And you can find a list of supported Fabric regions in this link. If you set up your Azure instance outside one of these regions, it's likely you will NOT have access to all the Fabric experiences - When you set up Azure DevOps organisation - this is a classic one. Unfortunately, currently you cannot connect an ADO repository to a Workspace attached to a Capacity in a different Azure region. It's also not possible to sync your Fabric workspace to an ADO repository on another tenant. - Setting up a new capacity. And then switching the Capacity of a workspace from Capacity A (in Region A) to Capacity B (in Region B) can cause issues too with Region Locking. This basically restricts you from making such a change, and might cause you to have to manually migrate your assets between two regions. What are your experiences, have you ever selected the wrong region and lived to regret it?
Whenever you are asked to select a Region, stop and think!
1 like β€’ Sep '24
Yes we did... Our tenant was in North Europe, and the Premium P1 capacity in Norway East. Did not compute....
1-2 of 2
Arve Bjanes
2
12points to level up
@arve-bjanes-1576
Work with Power BI. Background from sales and marketing.

Active 24d ago
Joined Aug 2, 2024
Powered by