Skip to content

[FEATURE] # Rows inserted in 'Insert into Table Select * from Table' Stmt #38

@vwake7

Description

@vwake7

Feature Description
Get # Rows inserted in 'Insert into Table Select * from Table' Stmt in Pystackql

Example(s)
In the below Insert if we can know the number of rows inserted into the table, it will be really helpful. Currently I am seeing this message using pystackql. Link to Discussion [https://github.com/stackql/stackql/discussions/406]

The operation was despatched successfully
  query = """
  Insert into azure.network.interfaces
  (
    resourceGroupName,
    subscriptionId,
    networkInterfaceName,
    data__location,
    data__properties
  )
  select
    '%s',
    '%s',
    'vmss-flex-vnet-nic01-manual-' || '%s',
    location,
    json_replace(json_remove(properties,
                                  '$.allowPort25Out',
                                  '$.auxiliarySku',
                                  '$.provisioningState',
                                  '$.resourceGuid',
                                  '$.macAddress',
                                  '$.vnetEncryptionSupported',
                                  '$.enableIPForwarding',
                                  '$.defaultOutboundAccess',
                                  '$.primary',
                                  '$.virtualMachine',
                                  '$.hostedWorkloads',
                                  '$.tapConfigurations',
                                  '$.nicType',
                                  '$.auxiliaryMode',
                                  '$.ipConfigurations[0].id',
                                  '$.ipConfigurations[0].etag',
                                  '$.ipConfigurations[0].type',
                                  '$.ipConfigurations[0].properties.provisioningState',
                                  '$.ipConfigurations[0].properties.privateIPAddress',
                                  '$.ipConfigurations[0].properties.privateIPAllocationMethod',
                                  '$.ipConfigurations[0].properties.primary',
                                  '$.ipConfigurations[0].properties.privateIPAddressVersion'
                                ),
                      '$.ipConfigurations[0].name',
                      'vmss-flex-vnet-nic01-defaultIpConfiguration'
                      )
  from
    azure.network.interfaces
  where subscriptionId = '%s'
  and resourceGroupName = '%s'
  and networkInterfaceName = '%s'
  ;""" % (rg,subscription_id,counter,subscription_id,rg,vm['nic_name'])

Possible Approaches or Libraries to Consider
@jeffreyaven suggested that there is usually one message inserted per row as per discussion.

The operation was despatched successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions