forked from testcontainers/testcontainers-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoracle.py
More file actions
26 lines (21 loc) · 809 Bytes
/
Copy pathoracle.py
File metadata and controls
26 lines (21 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from testcontainers.core.generic import DbContainer
class OracleDbContainer(DbContainer):
"""
Oracle database container.
Example
-------
::
with OracleDbContainer():
e = sqlalchemy.create_engine(oracle.get_connection_url())
result = e.execute("select 1 from dual")
"""
def __init__(self, image="wnameless/oracle-xe-11g-r2:latest"):
super(OracleDbContainer, self).__init__(image=image)
self.container_port = 1521
self.with_exposed_ports(self.container_port)
self.with_env("ORACLE_ALLOW_REMOTE", "true")
def get_connection_url(self):
return super()._create_connection_url(
dialect="oracle", username="system", password="oracle", port=self.container_port,
db_name="xe"
)