專案描述

A Python program that runs a SQL script stored in a text file against a PostgreSQL, MS-Access, SQLite, MS-SQL-Server, MySQL, MariaDB, Firebird, or Oracle database, or an ODBC DSN. execsql also supports a set of special commands (metacommands) that can import and export data, copy data between databases, conditionally execute SQL statements and metacommands, display data to the user, and prompt the user for additional information.

Different DBMSs and DBMS-specific client programs provide different and incompatible extensions to the SQL language, ordinarily to allow interactions with the file system and to allow conditional tests and looping. Some DBMSs do not have any native extensions of this sort. execsql provides these features, as well as features for user interaction, in an identical fashion for all supported DBMSs.

execsql's metacommands make up a control language that works the same across all supported DBMSs, and can be used to create both automated and interactive data processing applications. Metacommands are embedded in SQL comments, so they will be ignored by other script processors (e.g., psql for Postgres and sqlcmd for SQL Server).

execsql also supports substitution variables: words that can be replaced with alternate text anywhere within a SQL statement or metacommand. Substitution variables can be used for configuration settings, data values extracted from the database, or user input.

Whereas SQL is often embedded in programs written in other languages, execsql inverts this paradigm through the use of metacommands embedded in SQL scripts. This approach allows database operations to be interleaved with user interactions and file system access in a way that may be easier to develop, easier to re-use, and more accessible to multiple users than embedded SQL in a high-level programming language.

安裝

execsql.py can be installed as an executable script from the Python Package Index (PyPI) using pip:     `pip install execsql` Alternatively the execsql.py file can be downloaded from... 顯示如何安裝

用法

Complete documentation describing execsql's features and usage is at http://execsql.osdn.io/ . 顯示用法

下載

win32 Windows execsql.py (日期: 2023-07-09, 大小: 615.88 KB)
linux Linux execsql.py (日期: 2023-07-09, 大小: 615.88 KB)
unix_unknown UNIX execsql.py (日期: 2023-07-09, 大小: 615.88 KB)
source 原始碼 execsql.py (日期: 2023-07-09, 大小: 615.88 KB)

您的評分
撰寫專案評

使用統計

最近的活動

2023-08-23
2023-07-28
03:00
execsql
[Hg] commits were pushed to 'execsql' (current: b23cf26c3e1d4f27f156dc64b6f0c7dd62081874)
Built on r804. The FREE keyword for the PROMPT DISPLAY metacommand is reimplemented. New system...
2023-07-27
02:41
execsql
[Hg] commits were pushed to 'execsql' (current: 63dd58b580677328fac324b95c2ff83f96fd8f04)
Modified PERSIST option of PROMPT ACTION so it handles scripts that call scripts; forced a GUI co...
2023-07-26
09:05
execsql
Show history