Example #1
0
 def add_pet(data_api: DataAPI, pet_names: List[str]) -> None:
     response = data_api.execute('INSERT INTO pets (name) VALUES (:name)',
                                 {'name': pet_names[0]})
     assert response.generated_fields_first == 1
     response = data_api.execute('INSERT INTO pets (name) VALUES (:name)',
                                 {'name': pet_names[1]})
     assert response.generated_fields_first == 2
Example #2
0
def test_simple_execute(rds_data_client):
    data_api = DataAPI(
        resource_arn, secret_arn, database=database, client=rds_data_client
    )
    result: Result = data_api.execute('show tables')
    assert len(result.one()) == 1
    assert result.one()[0] == 'pets'
Example #3
0
 def add_pet(data_api: DataAPI, pet_names: List[str]) -> None:
     response = data_api.execute(Insert(Pets, {'name': pet_names[0]}))
     assert response.generated_fields_first == 1
     response = data_api.execute(Insert(Pets, {'name': pet_names[1]}))
     assert response.generated_fields_first == 2
Example #4
0
def add_pets(data_api: DataAPI, pet_names: List[str]) -> None:
    # start transaction
    for pet_name in pet_names:
        data_api.execute(Insert(Pets, {'name': pet_name}))
Example #5
0
def example_simple_execute():
    data_api = DataAPI(resource_arn=resource_arn, secret_arn=secret_arn, database=database)
    result: Result = data_api.execute('show tables')
    print(result.scalar())