1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How I can mapping Oracle data types to GridDB data types?

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024 às 07:02.

  1. Stack

    Stack Membro Participativo

    I am struggling with mapping Oracle data types to the corresponding GridDB data types. For instance, how should I handle Oracle’s and types when inserting them into GridDB? Are there specific best practices for ensuring data integrity during this conversion? VARCHAR2 NUMBER

    import oracledb
    import griddb_python as griddb

    # Connect to Oracle Database
    oracle_conn = oracledb.connect("admin/ali_786@localhost:1521/ORCL")
    oracle_cursor = oracle_conn.cursor()

    # Fetch data from Oracle table
    oracle_cursor.execute("SELECT * FROM Customers")

    # Connect to GridDB
    factory = griddb.StoreFactory.get_instance()
    griddb_store = factory.get_store(host="192.168.0.13", port=10001, cluster_name="zaigham", username="admin", password="ali_786")
    container = griddb_store.get_container("conn")

    # Ensure the container is ready to accept data
    container.set_auto_commit(False)

    # Insert data into GridDB
    for row in oracle_cursor:
    # Mapping Oracle row to GridDB types here, assuming the structure is compatible
    container.put(row)

    # Commit the transaction to GridDB
    container.commit()

    # Close connections
    oracle_cursor.close()
    oracle_conn.close()

    Continue reading...

Compartilhe esta Página