betodealmeida commented on a change in pull request #13561:
URL: https://github.com/apache/superset/pull/13561#discussion_r596408136



##########
File path: superset/utils/data.py
##########
@@ -53,24 +72,35 @@
 days_range = (MAXIMUM_DATE - MINIMUM_DATE).days
 
 
+# pylint: disable=too-many-return-statements, too-many-branches
 def get_type_generator(sqltype: sqlalchemy.sql.sqltypes) -> Callable[[], Any]:
-    if isinstance(sqltype, sqlalchemy.sql.sqltypes.INTEGER):
+    if isinstance(
+        sqltype, (sqlalchemy.sql.sqltypes.INTEGER, 
sqlalchemy.sql.sqltypes.Integer)
+    ):
         return lambda: random.randrange(2147483647)
 
     if isinstance(sqltype, sqlalchemy.sql.sqltypes.BIGINT):
         return lambda: random.randrange(sys.maxsize)
 
-    if isinstance(sqltype, sqlalchemy.sql.sqltypes.VARCHAR):
+    if isinstance(
+        sqltype, (sqlalchemy.sql.sqltypes.VARCHAR, 
sqlalchemy.sql.sqltypes.String)
+    ):
         length = random.randrange(sqltype.length or 255)
+        length = max(8, length)  # for unique values
+        length = min(100, length)  # for FAB perms
         return lambda: "".join(random.choices(string.printable, k=length))
 
-    if isinstance(sqltype, sqlalchemy.sql.sqltypes.TEXT):
+    if isinstance(
+        sqltype, (sqlalchemy.sql.sqltypes.TEXT, sqlalchemy.sql.sqltypes.Text)
+    ):
         length = random.randrange(65535)
         # "practicality beats purity"
         length = max(length, 2048)
         return lambda: "".join(random.choices(string.printable, k=length))
 
-    if isinstance(sqltype, sqlalchemy.sql.sqltypes.BOOLEAN):
+    if isinstance(
+        sqltype, (sqlalchemy.sql.sqltypes.BOOLEAN, 
sqlalchemy.sql.sqltypes.Boolean)
+    ):

Review comment:
       Bycatch




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to