Skip to content

Commit 9e77589

Browse files
committed
chore: minor cleanup
1 parent 3282893 commit 9e77589

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

samples/auto_generated_primary_key_sample.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import datetime
16-
import uuid
17-
1815
from sqlalchemy import create_engine
1916
from sqlalchemy.orm import Session
2017

2118
from sample_helper import run_sample
22-
from model import Singer, Concert, Venue, TicketSale
19+
from model import Venue
2320

2421

2522
# Shows how to use an IDENTITY column for primary key generation. IDENTITY
@@ -44,6 +41,14 @@ def auto_generated_primary_key_sample():
4441
"databases/sample-database",
4542
echo=True,
4643
)
44+
45+
# Add a line like the following to use AUTO_INCREMENT instead of IDENTITY
46+
# when creating tables in SQLAlchemy.
47+
# https://cloud.google.com/spanner/docs/primary-key-default-value#serial-auto-increment
48+
49+
# engine.dialect.use_auto_increment = True
50+
# Base.metadata.create_all(engine)
51+
4752
with Session(engine) as session:
4853
# Venue automatically generates a primary key value using an IDENTITY
4954
# column. We therefore do not need to specify a primary key value when

0 commit comments

Comments
 (0)