Skip to content

Conversation

pangpang20
Copy link
Collaborator

Description

This PR introduces a demo script for the GaussDB Python driver and updates the database compatibility mode to default mode A (Oracle compatibility). The changes include:

  1. Adding a demo script (example/demo.py) to demonstrate basic database operations (create, insert, update, select).
  2. Updating the README.rst to include instructions for running the demo and revising the database compatibility mode from PostgreSQL to default Oracle compatibility mode A.

Changes

  • Added Demo Script:
    • File: example/demo.py
    • A new Python script that connects to a GaussDB database, creates a table, inserts data, updates it, and queries the results.
    • Uses environment variable GAUSSDB_TEST_DSN for connection settings.
  • Updated README:
    • File: README.rst
    • Added instructions to run the demo script (python ./example/demo.py).
    • Revised database creation instructions to use default compatibility mode A (Oracle) instead of PostgreSQL compatibility.

Details

Demo Script

  • Location: example/demo.py
  • Functionality:
    • Connects to a GaussDB database using the provided DSN.
    • Drops existing table (if any), creates a new table (test), inserts sample data, updates a record, and queries the table.
    • Prints server version and vendor information for verification.
  • Requires GAUSSDB_TEST_DSN environment variable for database connection details.

README Updates

  • Added demo run instructions at line 55.
  • Changed database creation command from CREATE DATABASE test DBCOMPATIBILITY 'PG' to CREATE DATABASE test to use default Oracle compatibility mode A.

Testing

  • Verified the demo script (example/demo.py) successfully connects to a GaussDB database, performs CRUD operations, and outputs results as expected.
  • Confirmed the updated README.rst instructions accurately reflect the default compatibility mode A and demo execution steps.
  • Tested database creation with default mode A using gsql -c 'CREATE DATABASE test;'.

@liubao68 liubao68 merged commit c074e1d into HuaweiCloudDeveloper:master Jul 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants