I am trying to use table.column LIKE '%[A-Za-z]%
in Databricks notebook, but it returns no value.
It worked in SQL server, but it seems it's not working in Pysql.
Does anyone know what's the alternative in Databricks?
I am trying to use table.column LIKE '%[A-Za-z]%
in Databricks notebook, but it returns no value.
It worked in SQL server, but it seems it's not working in Pysql.
Does anyone know what's the alternative in Databricks?
The LIKE function has a limited functionality, so you need to use rlike instead:
select * .... where column rlike '.*[A-Za-z].*'
Update: real example:
%python
df = spark.createDataFrame([{'id': 1, 's':'12323'}, {'id': 1, 's':'123T23'}],
schema='id int, s string')
df.createOrReplaceTempView("rlike_test")
and query:
%sql
select * from rlike_test where s rlike '.*[A-Za-z].*'
here is result of execution: