Skip to main content

Arrow-mssql exporta tabela ou consulta para .parquet ou .csv, e também faz a leitura de .parquet ou .csv para tabela do sql server

Project description

Arrow-mssql

PyPI

O que é o Arrow-mssql ?

É um projeto que recebe uma tabela ou consulta do SQL SERVER e faz a exportação para um arquivo .parquet ou .csv, utilizando a solução arrow que é uma tecnologia com foco em análise e desempenho na memória.

Também é possível importar um arquivo .parquet para uma tabela do sql server ou arquivo .csv.

Instalação

pip install arrow-mssql

Conexão

Para se conectar ao sql server o driver padrão é o pyodbc é preciso fornecedor uma string de conexao

somente a string de conexão é permitida

DRIVER = (
    'Driver={ODBC Driver 18 for Sql Server};'
    'Server=seu_servidor;'
    'Database=seu_banco_de_dados;'
    'TrustServerCertificate=Yes;'
    'Authentication=ActiveDirectoryIntegrated;'
)

Como usar ?

Tanto uma tabela ou consulta pode ser exportada

a exportacao é feita de forma incrimental por lotes de dados

# EXPORTANDO UMA TABELA -- para csv
to_csv(
    DRIVER, 
    'NOME_TABELA',
    schema='dbo',
    database='seu_banco', 
    path='destino.csv'
)

# EXPORTANDO UMA CONSULTA -- para .parquet
to_parquet(
    DRIVER, 
    'SELECT N1, N2 FROM NOME_TABELA WHERE N1 = 0', 
    schema='dbo',
    database='seu_banco', 
    path='destino.parquet'
)

É possivel importar arquivos csv ou parquet, definir um limite de linhas e colunas no processo.

# IMPORTAR .parquet para tabela temporaria do ssms
# o retornor é um cursor referente a conexao com o banco de dados
with write_parquet(
    DRIVER, 
    '##teste', 
    path='origem.parquet'
) as C:

    ...

# AGORA é possivel importar um numero limite de linhas
# e selecionar as colunas no arquivo parquet
with write_parquet(
    DRIVER, 
    '##teste', 
    path='origem.parquet',
    limit=100,
    columns=['col1', 'col2']
) as C:

    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arrow_mssql-0.0.88.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arrow_mssql-0.0.88-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file arrow_mssql-0.0.88.tar.gz.

File metadata

  • Download URL: arrow_mssql-0.0.88.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/10

File hashes

Hashes for arrow_mssql-0.0.88.tar.gz
Algorithm Hash digest
SHA256 572f8ec7b37ee1d6d363c9444043356ff3e08d2a8ad47136f5c99b08eae354ea
MD5 b34aa66fde43f686dbc8fd4066d6f070
BLAKE2b-256 a9a129d34b8919751d92d5d85ee1f0e81c5202069ac4e09e950e8795f330feb5

See more details on using hashes here.

File details

Details for the file arrow_mssql-0.0.88-py3-none-any.whl.

File metadata

  • Download URL: arrow_mssql-0.0.88-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/10

File hashes

Hashes for arrow_mssql-0.0.88-py3-none-any.whl
Algorithm Hash digest
SHA256 6f50441494941db66c179df62080c24555210e1eceec214f60acbee73c2528ce
MD5 be6faa1af145f29184fd80782cc33d86
BLAKE2b-256 21637b2eb55886210d0079a61736d589d8810e3da4593e73e8a230ff86c9206d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page