-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add WriteFile command #89
Conversation
a757ced
to
b8d1bae
Compare
ad32613
to
dcd67fd
Compare
# host='DOCKER_IP' will be replaced with the ip address given from pytest-docker | ||
# port=-1 will be replaced with the ip address given from pytest-docker | ||
|
||
POSTGRES_DB = dbs.PostgreSQLDB(host='DOCKER_IP', port=-1, user="mara", password="mara", database="mara") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not pick that from an env var and add a fixture to set the env var? Or just create this in the fixture, where you have all the information (and return the DB)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yee... I am not 100% sure about that. This is actually a copy from the test suite of the mara_db
project. See local_config.py.example.
The main purpose that I defined it in a separate config file is that you have the option to simply activate / disable the tests for specific database engines. Especially for test against cloud services this is handy. I don't want to share the credentials for my cloud with everybody but at the same time share the option for those who want to test their changes against the cloud ;-)
Removing this and integrating it into the fixture makes sence for now, but maybe not in the future...
compression: Compression = Compression.NONE, | ||
format: formats.Format = formats.CsvFormat()) -> None: | ||
""" | ||
Writes the output of a sql query to a file in a specific format. The command is executed on the shell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... on the shell on the machine which runs mara (e.g. in the docker container!).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true! I am not happy with that everything in Mara runs through a shell command. For example, when I run mara in a Jupyter Notebook, it is pretty stupid that I have to carry out commands to make sure that the shell toolings are installed. It would be much smarter to use sqlalchemy or a DB API instead. I had already in mind to add a SqlExecutionContext
which doesn't use shell but the DB API or SQLAlchemy, but ... didn't really had a usecase where I needed it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See minor doc/test comments...
dcd67fd
to
9ccd88f
Compare
9a2d222
to
ec3adf5
Compare
Add a command to write a sql query result to a file in a specific format.
mara_storage