Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
sarus_sql / PKG-INFO
Size: Mime:
Metadata-Version: 2.1
Name: sarus_sql
Version: 3.0.0.dev3
Summary: Library to manipulate SQL queries
Author: Sarus
License: PRIVATE
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: sqlalchemy~=2.0
Requires-Dist: smartnoise-sql>=0.2.102
Requires-Dist: opendp-smartnoise-core==0.2.3
Provides-Extra: tests
Requires-Dist: pytest>=6.2; extra == "tests"
Requires-Dist: pytest-cov>=2.12; extra == "tests"
Requires-Dist: mypy==1.9.0; extra == "tests"
Provides-Extra: panachage
Requires-Dist: tensorflow>=2.0; (sys_platform != "darwin" or platform_machine != "arm64") and extra == "panachage"
Requires-Dist: tensorflow-macos>=2.0; (sys_platform == "darwin" and platform_machine == "arm64") and extra == "panachage"
Requires-Dist: numpy<2.0,>=1.17; extra == "panachage"

# sarus-sql

Differentially private SQL

## Installation
To start using `sarus_sql`,

```shell script
    apt-get update
    apt-get install -y protobuf-compiler build-essential
    pip install mypy-protobuf pytest
    pip install --extra-index-url=https://${FURY_AUTH}:@pypi.fury.io/sarus/ .
    make
```

## Example with postgres
```
export PGPASSWORD=1234
pip install psycopg2
docker run --name some-postgres -e POSTGRES_PASSWORD=$PGPASSWORD -d postgres
docker cp tests/ressources some-postgres:.
docker exec some-postgres psql -U postgres -h localhost -p 5432 -f tests/ressources/test_database/install_postgres.sql
python examples/test_queries.py -e postgres
```

## Example with mssql
```
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pass1234" -p 1433:1433 --name some-mssql -d mcr.microsoft.com/mssql/server:2019-CU13-ubuntu-20.04
```

Copy the files. Do not copy them in the root directory to avoid the file access right issu. (https://stackoverflow.com/questions/59013661/cannot-bulk-load-the-file-does-not-exist-or-you-dont-have-file-access-rights)
```
docker cp tests/ressources/test_database some-mssql:/tmp
```
Install the db
```
docker exec some-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Pass1234 -i tmp/test_database/install_mssql.sql

docker exec some-mssql  /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Pass1234 -d "test_database" -q "BULK INSERT census FROM '/tmp/test_database/extract_census.csv' WITH (FORMAT='CSV',FIRSTROW = 2, FIELDTERMINATOR=',', ROWTERMINATOR='\n', TABLOCK);"

docker exec some-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Pass1234 -d "test_database" -q "BULK INSERT beacon FROM '/tmp/test_database/extract_beacon.csv' WITH (FORMAT='CSV',FIRSTROW = 1, FIELDTERMINATOR=',', ROWTERMINATOR='\n', TABLOCK);"

docker exec some-mssql  /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Pass1234 -d "test_database_synth" -q "BULK INSERT census_synth FROM '/tmp/test_database/extract_census.csv' WITH (FORMAT='CSV',FIRSTROW = 2, FIELDTERMINATOR=',', ROWTERMINATOR='\n', TABLOCK);"

docker exec some-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Pass1234 -d "test_database_synth" -q "BULK INSERT beacon_synth FROM '/tmp/test_database/extract_beacon.csv' WITH (FORMAT='CSV',FIRSTROW = 1, FIELDTERMINATOR=',', ROWTERMINATOR='\n', TABLOCK);"

python examples/test_queries.py -e mssql
```



## Tests
The mocks for the tests can be generated with `python tests/ressources/generate_protos.py`

## Quickstart

## Project status

### Current features

### Known limitations / Bugs


## Acknowledgements

### Contributors

### Miscellaneous

This project was created with the sarus-cookiecutter
version [1.0.0].