Skip to content

Commit 578f394

Browse files
authored
Use typing.Text for String (#53)
1 parent 0a9dde1 commit 578f394

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sqlalchemy-stubs/sql/sqltypes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Indexable(object):
2222

2323
# Docs say that String is unicode when DBAPI supports it
2424
# but it should be all major DBAPIs now.
25-
class String(Concatenable, TypeEngine[str]): # XXX: should be typing_Text
25+
class String(Concatenable, TypeEngine[typing_Text]):
2626
__visit_name__: str = ...
2727
length: Optional[int] = ...
2828
collation: Optional[str] = ...
@@ -39,7 +39,7 @@ class String(Concatenable, TypeEngine[str]): # XXX: should be typing_Text
3939
def bind_processor(self, dialect: Dialect) -> Optional[Callable[[str], str]]: ...
4040
def result_processor(self, dialect: Dialect, coltype: Any) -> Optional[Callable[[Optional[Any]], Optional[str]]]: ...
4141
@property
42-
def python_type(self) -> Type[str]: ...
42+
def python_type(self) -> Type[typing_Text]: ...
4343
def get_dbapi_type(self, dbapi: Any) -> Any: ...
4444

4545
class Text(String):

test/test-data/sqlalchemy-basics.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class User(Base):
102102

103103
user = User()
104104
reveal_type(user.id) # E: Revealed type is 'builtins.int*'
105-
reveal_type(User.name) # E: Revealed type is 'sqlalchemy.sql.schema.Column[Union[builtins.str*, None]]'
105+
reveal_type(User.name) # E: Revealed type is 'sqlalchemy.sql.schema.Column[Union[builtins.unicode*, None]]'
106106
[out]
107107

108108
[case testColumnFieldsInferredInstance_python2]
@@ -118,5 +118,5 @@ class User(Base):
118118

119119
user = User()
120120
reveal_type(user.id) # E: Revealed type is 'builtins.int*'
121-
reveal_type(User.name) # E: Revealed type is 'sqlalchemy.sql.schema.Column[builtins.str*]'
121+
reveal_type(User.name) # E: Revealed type is 'sqlalchemy.sql.schema.Column[builtins.unicode*]'
122122
[out]

0 commit comments

Comments
 (0)