SimplySql | PowerShell module for querying various SQL databases | SQL Database library
kandi X-RAY | SimplySql Summary
kandi X-RAY | SimplySql Summary
Querying SQL (SQL Server, Oracle, PostgreSql, SQLite, & mySql) the PowerShell way: simple commands... powerful opportunities. SimplySql is a module that provides an intuitive set of cmdlets for talking to databases that abstracts the vendor specifics, allowing you to focus on getting work done. The basic pattern is to connect to a database, invoke one or more sql statements and then close your database connection. This module provides cmdlets that map to this basic pattern. Each Provider has its own 'Open-*Connection' cmdlet, but the remaining cmdlets are provider agnostic (MSSQL: Open-SqlConnection, Oracle: Open-OracleConnection, SQLite: Open-SQLiteConnection, etc). You can have multiple connections open, just distinguish them through the use of the -ConnectionName parameter on every command (if no ConnectionName is specified, it defaults to 'default'). See the Wiki for more details.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SimplySql
SimplySql Key Features
SimplySql Examples and Code Snippets
Community Discussions
Trending Discussions on SimplySql
QUESTION
some background: currently I am querying 4Mio rows (with 50 columns) from a MS SQL server with dbatools into a PSObject (in Batch 10.000 rows each query), processing the data with PowerShell (a lot of RegEx stuff) and writing back into a MariaDb with SimplySql. In average i get approx. 150 rows/sec. Had to use a lot of tricks (Net's Stringbuilder etc.) for this performance, its not that bad imho
As new requirements I want to detect the language of some text cells and I have to remove personal data (name & address). I found some good python libs (spacy and pycld2) for that purpose. I made tests with pycld2 - pretty good detection.
Simplified code for clarification (hint:I am a python noob):
...ANSWER
Answered 2020-Nov-29 at 21:30The following simplified example shows you how you can pass multiple [pscustomobject]
([psobject]
) instances from PowerShell to a Python script (passed as a string via -c
in this case):
by using JSON as the serialization format, via
ConvertTo-Json
...... and passing that JSON via the pipeline, which Python can read via stdin (standard input).
Important:
Character encoding:
PowerShell uses the encoding specified in the
$OutputEncoding
preference variable when sending data to external programs (such as Python), which commendably defaults to BOM-less UTF-8 in PowerShell [Core] v6+, but regrettably to ASCII(!) in Windows PowerShell.Just like PowerShell limits you to sending text to an external program, it also invariably interprets what it receives as text, namely based on the encoding stored in
[Console]::OutputEncoding
; regrettably, both PowerShell editions as of this writing default to the system's OEM code page.To both send and receive (BOM-less) UTF-8 in both PowerShell editions, (temporarily) set
$OutputEncoding
and[Console]::OutputEncoding
as follows:
$OutputEncoding = [Console]::OutputEncoding = [System.Text.Utf8Encoding]::new($false)
If you want your Python script to also output objects, again consider using JSON, which on the PowerShell you can parse into objects with
ConvertFrom-Json
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SimplySql
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page