Custom operator name field dont accept special characters
See original GitHub issueApache Airflow version: 1.10.2 --> 1.10.11
Kubernetes version (if you are using kubernetes) (use kubectl version
):
Environment:
- Cloud provider or hardware configuration: Internal Cloud solution (VM hosting)
- OS (e.g. from /etc/os-release): rhel 7.7
- Kernel (e.g.
uname -a
): any - Install tools: pypi
- Others:
What happened:
Cant import operator if name field contains special or caps character
What you expected to happen:
Load the operator even name contains special character
How to reproduce it: just add special or caps characters to the class field name example :
import logging
from airflow.models import BaseOperator
from airflow.plugins_manager import Airflowplugin
from airflow.utils.decorators import apply_defaults
log = logging.getLogger(__name__)
class DevMultiplyOperator(BaseOperator):
@apply_defaults
def __init__(self, my_operator_param, * args, ** kwargs):
self.operator_param = my_operator_param
super(DevMultiplyoperator, self).__init__( * args, ** kwargs)
def execute(self, context):
try:
log.info('operator_param: %s', self.operator_param)
if not isinstance(self.operator_param, int):
raise TypeError('Use integer as inputs.')
return (self.operator_param * 5)
except Exception as error:
log.error(error)
raise
class DevMultiplyPlugin(AirflowPlugin):
name = "dev_multiply_plugin"
operators = [DevMultiplyoperator]
Anything else we need to know: We are using plugins directory to host operators/hooks/sensor to better organize project. /dags --> contains dags and subdags /plugins --> contains operators/hooks/sensor /config --> contains configuration files /tests --> contains tests files
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (4 by maintainers)
Top Results From Across the Web
how to not allow user to give special characters, numbers ...
Save this answer. Show activity on this post. You can try the carrot symbol in regex -> Something like /^[A-Za-z]/ -> this will...
Read more >Should we allow special characters or numbers in name field?
Yes you should! Your suggestion about having a validation rule would be a very bad idea. Did you know, the world's most common...
Read more >Errors using special characters in Access databases - Office
Lists the special characters to avoid using when you work with the database object names or the field names in all versions of...
Read more >Using Special Characters in Queries - Coveo Documentation
When two equal characters appear between a field name and its argument, these equal signs act as an exact, contiguous, and same order...
Read more >How to delete special / unwanted characters in Excel - Ablebits
See how to strip special characters from a text string using Excel formulas and remove unwanted characters from multiple cells with custom ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ephraimbuddy That is Python2 vs Python3 syntax. Airflow code base has switched to the later, but the former will still work on Python3 without trouble, so it’s not that.
@aladinoss How were you trying to import this? What error did you receive when you did so?
Closing due to no response. We can reopen this if we get more details.