@@ -3266,19 +3266,21 @@ def test_having(self):
3266
3266
3267
3267
self .session .sql (
3268
3268
f"""
3269
- CREATE TABLE { table_name } "
3270
- (age, name VARCHAR(50) PRIMARY KEY , gender CHAR(1))
3269
+ CREATE TABLE { table_name }
3270
+ (id INT PRIMARY KEY, age INT , name VARCHAR(50), gender CHAR(1))
3271
3271
"""
3272
3272
).execute ()
3273
- self .session .sql (f"INSERT INTO { table_name } VALUES (21, 'Fred', 'M')" ).execute ()
3274
3273
self .session .sql (
3275
- f"INSERT INTO { table_name } VALUES (28, 'Barney', 'M')"
3274
+ f"INSERT INTO { table_name } VALUES (1, 21, 'Fred', 'M')"
3275
+ ).execute ()
3276
+ self .session .sql (
3277
+ f"INSERT INTO { table_name } VALUES (2, 28, 'Barney', 'M')"
3276
3278
).execute ()
3277
3279
self .session .sql (
3278
- f"INSERT INTO { table_name } VALUES (42, 'Wilma', 'F')"
3280
+ f"INSERT INTO { table_name } VALUES (3, 42, 'Wilma', 'F')"
3279
3281
).execute ()
3280
3282
self .session .sql (
3281
- f"INSERT INTO { table_name } VALUES (67, 'Betty', 'F')"
3283
+ f"INSERT INTO { table_name } VALUES (4, 67, 'Betty', 'F')"
3282
3284
).execute ()
3283
3285
3284
3286
table = self .schema .get_table ("test" )
@@ -4025,18 +4027,20 @@ def test_having(self):
4025
4027
self .session .sql (
4026
4028
f"""
4027
4029
CREATE TABLE { table_name }
4028
- (age INT, name VARCHAR(50) PRIMARY KEY , gender CHAR(1))
4030
+ (id INT PRIMARY KEY, age INT, name VARCHAR(50), gender CHAR(1))
4029
4031
"""
4030
4032
).execute ()
4031
- self .session .sql (f"INSERT INTO { table_name } VALUES (21, 'Fred', 'M')" ).execute ()
4032
4033
self .session .sql (
4033
- f"INSERT INTO { table_name } VALUES (28, 'Barney ', 'M')"
4034
+ f"INSERT INTO { table_name } VALUES (1, 21, 'Fred ', 'M')"
4034
4035
).execute ()
4035
4036
self .session .sql (
4036
- f"INSERT INTO { table_name } VALUES (42, 'Wilma ', 'F ')"
4037
+ f"INSERT INTO { table_name } VALUES (2, 28, 'Barney ', 'M ')"
4037
4038
).execute ()
4038
4039
self .session .sql (
4039
- f"INSERT INTO { table_name } VALUES (67, 'Betty', 'F')"
4040
+ f"INSERT INTO { table_name } VALUES (3, 42, 'Wilma', 'F')"
4041
+ ).execute ()
4042
+ self .session .sql (
4043
+ f"INSERT INTO { table_name } VALUES (4, 67, 'Betty', 'F')"
4040
4044
).execute ()
4041
4045
4042
4046
defined_as = f"SELECT age, name, gender FROM { table_name } "
@@ -4071,11 +4075,14 @@ def test_having(self):
4071
4075
self .assertEqual (21 , rows [1 ]["age" ])
4072
4076
4073
4077
def test_insert (self ):
4074
- table_name = "{0}.{1}" . format ( self .schema_name , self . table_name )
4078
+ table_name = f" { self . schema_name } . { self .table_name } "
4075
4079
4076
4080
self .session .sql (
4077
- "CREATE TABLE {0} (age INT, name VARCHAR(50) PRIMARY KEY, "
4078
- "gender CHAR(1))" .format (table_name )
4081
+ f"""
4082
+ CREATE TABLE { table_name }
4083
+ (id INT AUTO_INCREMENT PRIMARY KEY, age INT, name VARCHAR(50),
4084
+ gender CHAR(1))
4085
+ """
4079
4086
).execute ()
4080
4087
defined_as = "SELECT age, name, gender FROM {0}" .format (table_name )
4081
4088
view = create_view (self .schema , self .view_name , defined_as )
@@ -4104,12 +4111,13 @@ def test_insert(self):
4104
4111
self .assertEqual (6 , len (rows ))
4105
4112
4106
4113
def test_update (self ):
4107
- table_name = "{0}.{1}" . format ( self .schema_name , self . table_name )
4114
+ table_name = f" { self . schema_name } . { self .table_name } "
4108
4115
4109
4116
self .session .sql (
4110
4117
f"""
4111
4118
CREATE TABLE { table_name }
4112
- (age INT, name VARCHAR(50) PRIMARY KEY, gender CHAR(1))
4119
+ (id INT AUTO_INCREMENT PRIMARY KEY, age INT, name VARCHAR(50),
4120
+ gender CHAR(1))
4113
4121
"""
4114
4122
).execute ()
4115
4123
defined_as = f"SELECT age, name, gender FROM { table_name } "
0 commit comments